1

I need to follow the same pattern regarding the position of the markers, (like if the line is pointing down then the marker has to point down etc) as they appear in this picture:

enter image description here

\documentclass{standalone}
\usepackage{subcaption}
\usepackage{caption}
\usepackage{pgfplots, pgfplotstable}
\usetikzlibrary{positioning}
\pgfplotsset{compat=1.16,width=0.98\textwidth}
%\pgfplotsset{compat=1.16,width=0.98\textwidth}

\usepackage{tikz}
\usepackage[english,spanish]{babel}         % multilenguaje

% grid style

\pgfdeclareplotmark{mystar}{
    \node[star,star point ratio=2.25,minimum size=6pt,
    inner sep=0pt,draw=black,solid,fill=red] {};
}

\decimalpoint
\definecolor{delanblue}{RGB}{161,160,250}
\begin{document}



    % This file was created by matplotlib2tikz v0.7.4.
    \begin{tikzpicture}



    \begin{axis}[
    axis line style={black},
    legend cell align={left},
    legend style={draw=black},
    tick align=outside,
    x grid style={dashed,black!60},
    xlabel={Factors},
    xmajorticks=true,
    xmin=-2.9, xmax=104.9,
    xtick style={color=black},
    y grid style={dashed,black!60},
    ylabel={RMSE},
    ymajorticks=true,
    ymin=0.919143916827522, ymax=0.958251192094697,
    ytick style={black},
    xtick align=inside,
    ytick align=inside,
    grid = both
    ]
    \addplot [mark =o,line width=1pt,blue, mark size=1pt]
table {%
2 0.956473588673462
4 0.95581695995998
6 0.952855723500684
8 0.950892782319065
10 0.948923319657985
12 0.949187211337019
14 0.948920300951509
16 0.946627747800603
18 0.949897908530731
20 0.946524031542774
22 0.945664252363951
24 0.945327312396633
26 0.946146296600081
28 0.944360527615089
30 0.944591823913328
32 0.944583303918414
34 0.944936888818154
36 0.943683193640638
38 0.941884343779302
40 0.943224882278542
42 0.942531142481867
44 0.942480886710035
46 0.94252268920082
48 0.94484988361442
50 0.942688863012827
52 0.941735681958819
54 0.941401884859045
56 0.942762996973662
58 0.939961343704454
60 0.94132867262337
62 0.942568106870625
64 0.940871550038187
66 0.941996843016503
68 0.942220262329667
70 0.941193127573621
72 0.940683678940177
74 0.941166200273454
76 0.941252410950958
78 0.940844634473991
80 0.941633549512695
82 0.940732102521469
84 0.939993250501553
86 0.940624025190322
88 0.941678475660186
90 0.941561568249023
92 0.941819817324707
94 0.939380841562355
96 0.94141756997053
98 0.940684254099713
100 0.941851423706501
};
\addlegendentry{10 Epochs}
    \addplot [mark =o,line width=1pt,black, mark size=1pt]
table {%
2 0.933380234415433
4 0.930384338853463
6 0.922634608711301
8 0.926267532952396
10 0.922068762043306
12 0.923265182004784
14 0.920921520248757
16 0.922558018930287
18 0.921972208639843
20 0.921572254464212
22 0.92130858302966
24 0.922743718871621
26 0.923897157003586
28 0.922059640333891
30 0.922841789947423
32 0.921387334091647
34 0.922093883281362
36 0.922755038462304
38 0.925178562528589
40 0.923002215125785
42 0.923989770107367
44 0.921181384311857
46 0.923844152591528
48 0.921175185769263
50 0.92272146793512
52 0.923627894951549
54 0.923281267712815
56 0.923150560376069
58 0.921443380143081
60 0.923601416838977
62 0.922979026480458
64 0.921885762472021
66 0.923236961666395
68 0.924191349041693
70 0.923600290065756
72 0.924422463901477
74 0.922812994762698
76 0.923027500804758
78 0.922698584138661
80 0.924339515792948
82 0.92375504951841
84 0.922219162474767
86 0.923169994638768
88 0.92422384132242
90 0.924126522118182
92 0.924945221936996
94 0.924507408827891
96 0.924317754033887
98 0.924184394689366
100 0.923914378496929
};
\addlegendentry{50 Epochs}
    \addplot [mark =o,line width=1pt,orange, mark size=1pt]
table {%
2 0.929975480461991
4 0.925119797236488
6 0.925103247961977
8 0.925867586041798
10 0.929372233644319
12 0.931361382766651
14 0.931173237027586
16 0.934103524527514
18 0.933741320254324
20 0.93854718223149
22 0.93721567339868
24 0.936999718724604
26 0.936842564031049
28 0.938048051799307
30 0.936855593968702
32 0.93787588633253
34 0.935610347559939
36 0.93483749392865
38 0.937980509270459
40 0.935185159717686
42 0.934246133800013
44 0.93561746534222
46 0.934746554606285
48 0.93436993328662
50 0.933392615118271
52 0.932409088253471
54 0.932449102454018
56 0.933125324263402
58 0.933147726910546
60 0.93317881372337
62 0.931089514453715
64 0.93095075005357
66 0.931471854929942
68 0.929508307010422
70 0.931020992329673
72 0.929202897316889
74 0.929454795842751
76 0.929949923125555
78 0.929223403447823
80 0.930285321465867
82 0.928115489003348
84 0.927275430549954
86 0.930606266467743
88 0.929906171458816
90 0.929870678484603
92 0.928469060661724
94 0.926492933607417
96 0.928955188630559
98 0.92778393253055
100 0.92866998351318
};
\addlegendentry{100 Epochs}
\end{axis}

\end{tikzpicture}
\end{document}

This yields

enter image description here

  • 1
    The markers you are using in your example are round. Rotating them won't have a visible effect. Which markers are you really looking for? – marmot Jun 14 at 6:49
  • Whatever that resembles what’s on the desired output picture! – NaveganTeX Jun 14 at 6:51
  • 1
    OK, but in your plot the markers sit at corners. How would TikZ know what the right rotation angle is? In a smooth plot you could use the tangent direction, but in your plots the tangents are undefined precisely at the points at which the marks sit. – marmot Jun 14 at 6:52
  • 1
    There is @pre marker code and the like but all of this requires some prescription. (Will go hibernate now. ;-) – marmot Jun 14 at 7:02
  • 1
    The prescription needs to come from you, i.e. you have to define how the markers are to be rotated. Then you can use @pre marker code to implement the prescription into pgfplots. At this point I do not know by which angle the individual markers are to be rotated. – marmot Jun 14 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.