Ändern der Werte auf der Y-Achse

Ändern der Werte auf der Y-Achse

Ich brauche Werte auf der Y-Achse von 96 statt 0,96. Das heißt, wie multipliziere ich diese Y-Achsenwerte mit 2?

Bildbeschreibung hier eingeben

\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{color0}{rgb}{1,1,0}
\definecolor{color1}{rgb}{1,0.647058823529412,0}
\begin{document}




    \begin{tikzpicture}



    \begin{axis}[
    axis line style={black},
    scaled x ticks = false,
    legend cell align={left},
    legend style={at={(0.97,0.03)}, anchor=south east, draw=black},
    tick align=outside,
    x grid style={dashed,black!60},
    xlabel={$\lambda$},
    xmajorticks=true,
    xmin=-0.0395, xmax=1.0495,
    xtick style={color=black},
    y grid style={dashed,black!60},
    ylabel={RMSE},
    ymajorticks=true,
    ymin=0.846942213907375, ymax=0.970121133137966,
    ytick style={black},
    xtick align=inside,
    ytick align=inside,
    grid = none,
    y tick label style={
        /pgf/number format/.cd,
        fixed,
        fixed zerofill,
        precision=4
    },
    ]
    \addplot [mark =,line width=0.7pt,blue, mark size=2pt]
    table {
0.01 0.8822
0.03 0.8615
0.05 0.854
0.07 0.8597
0.2 0.9155
0.5 0.9344
1 0.9639
};
\addlegendentry{20 f}
\addplot [line width=0.7pt ,black]
table {%
0.01 0.898481256113781
0.03 0.865873246257198
0.05 0.853726601717427
0.07 0.857932550788363
0.2 0.915144334833605
0.5 0.934927092350177
1 0.964522091354758
};
\addlegendentry{30 f}
\addplot [line width=0.7pt, red]
table {%
0.01 0.922581329120646
0.03 0.872177303638855
0.05 0.853365286503622
0.07 0.856359118109799
0.2 0.914724879701767
0.5 0.93512077918702
1 0.964292857206321
};
\addlegendentry{50 f}
\addplot [line width=0.7pt, yellow]
table {%
0.01 0.950247302117098
0.03 0.875862014017094
0.05 0.852945808571336
0.07 0.854889118499624
0.2 0.914000991451563
0.5 0.935209713188576
1 0.963770499326312
};
\addlegendentry{100 f}
\addplot [line width=0.7pt, orange]
table {%
0.01 0.951706952935797
0.03 0.873982593809665
0.05 0.852541255690584
0.07 0.854396792085605
0.2 0.913496001521785
0.5 0.934766529974339
1 0.963747053113756
};
\addlegendentry{150 f}
\end{axis}

\end{tikzpicture}
\end{document}

Antwort1

Ändern Sie einfach das precisionArgument in 0und fügen Sie es yticklabel = {\pgfmathparse{\tick*100}\pgfmathprintnumber{\pgfmathresult}}zu Ihrer axisUmgebung hinzu, um die Werte mit 100 zu multiplizieren und anzuzeigen:

\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{color0}{rgb}{1,1,0}
\definecolor{color1}{rgb}{1,0.647058823529412,0}
\begin{document}

    \begin{tikzpicture}

        \begin{axis}[
        axis line style={black},
        scaled x ticks = false,
        legend cell align={left},
        legend style={at={(0.97,0.03)}, anchor=south east, draw=black},
        tick align=outside,
        x grid style={dashed,black!60},
        xlabel={$\lambda$},
        xmajorticks=true,
        xmin=-0.0395, xmax=1.0495,
        xtick style={color=black},
        y grid style={dashed,black!60},
        ylabel={RMSE},
        ymajorticks=true,
        ymin=0.846942213907375, ymax=0.970121133137966,
        ytick style={black},
        xtick align=inside,
        ytick align=inside,
        grid = none,
        y tick label style={
            /pgf/number format/.cd,
            fixed,
            fixed zerofill,
            precision=0
        },
        yticklabel = {\pgfmathparse{\tick*100}\pgfmathprintnumber{\pgfmathresult}}
    ]

        \addplot [mark =,line width=0.7pt,blue, mark size=2pt]
        table {
            0.01 0.8822
            0.03 0.8615
            0.05 0.854
            0.07 0.8597
            0.2 0.9155
            0.5 0.9344
            1 0.9639
        };
        \addlegendentry{20 f}
        \addplot [line width=0.7pt ,black]
        table {%
            0.01 0.898481256113781
            0.03 0.865873246257198
            0.05 0.853726601717427
            0.07 0.857932550788363
            0.2 0.915144334833605
            0.5 0.934927092350177
            1 0.964522091354758
        };
        \addlegendentry{30 f}
        \addplot [line width=0.7pt, red]
        table {%
            0.01 0.922581329120646
            0.03 0.872177303638855
            0.05 0.853365286503622
            0.07 0.856359118109799
            0.2 0.914724879701767
            0.5 0.93512077918702
            1 0.964292857206321
        };
        \addlegendentry{50 f}
        \addplot [line width=0.7pt, yellow]
        table {%
            0.01 0.950247302117098
            0.03 0.875862014017094
            0.05 0.852945808571336
            0.07 0.854889118499624
            0.2 0.914000991451563
            0.5 0.935209713188576
            1 0.963770499326312
        };
        \addlegendentry{100 f}
        \addplot [line width=0.7pt, orange]
        table {%
            0.01 0.951706952935797
            0.03 0.873982593809665
            0.05 0.852541255690584
            0.07 0.854396792085605
            0.2 0.913496001521785
            0.5 0.934766529974339
            1 0.963747053113756
        };
        \addlegendentry{150 f}

        \end{axis}

    \end{tikzpicture}

\end{document}

Antwort2

Du könntest die Werte einfach entsprechend ändern (?)

\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{color0}{rgb}{1,1,0}
\definecolor{color1}{rgb}{1,0.647058823529412,0}
\begin{document}




    \begin{tikzpicture}



        \begin{axis}[
        axis line style={black},
        scaled x ticks = false,
        legend cell align={left},
        legend style={at={(0.97,0.03)}, anchor=south east, draw=black},
        tick align=outside,
        x grid style={dashed,black!60},
        xlabel={$\lambda$},
        xmajorticks=true,
        xmin=-0.0395, xmax=1.0495,
        xtick style={color=black},
        y grid style={dashed,black!60},
        ylabel={RMSE},
        ymajorticks=true,
        ymin=84.6942213907375, ymax=97.0121133137966,
        ytick style={black},
        xtick align=inside,
        ytick align=inside,
        grid = none,
        y tick label style={
        /pgf/number format/.cd,
        fixed,
        fixed zerofill,
        precision=4
        },
        ]
            \addplot [mark =,line width=0.7pt,blue, mark size=2pt]
            table {
            0.01 88.22
            0.03 86.15
            0.05 85.4
            0.07 85.97
            0.2 91.55
            0.5 93.44
            1.0 96.39
            };
            \addlegendentry{20 f}
            \addplot [line width=0.7pt ,black]
            table {%
            0.01 89.8481256113781
            0.03 86.5873246257198
            0.05 85.3726601717427
            0.07 85.7932550788363
            0.2 91.5144334833605
            0.5 93.4927092350177
            1.0 96.4522091354758
            };
            \addlegendentry{30 f}
            \addplot [line width=0.7pt, red]
            table {%
            0.01 92.2581329120646
            0.03 87.2177303638855
            0.05 85.3365286503622
            0.07 85.6359118109799
            0.2 91.4724879701767
            0.5 93.512077918702
            1.0 96.4292857206321
            };
            \addlegendentry{50 f}
            \addplot [line width=0.7pt, yellow]
            table {%
            0.01 95.0247302117098
            0.03 87.5862014017094
            0.05 85.2945808571336
            0.07 85.4889118499624
            0.2 91.4000991451563
            0.5 93.5209713188576
            1.0 96.3770499326312
            };
            \addlegendentry{100 f}
            \addplot [line width=0.7pt, orange]
            table {%
            0.01 95.1706952935797
            0.03 87.3982593809665
            0.05 85.2541255690584
            0.07 85.4396792085605
            0.2 91.3496001521785
            0.5 93.4766529974339
            1.0 96.3747053113756
            };
            \addlegendentry{150 f}
        \end{axis}

    \end{tikzpicture}
\end{document}

Dadurch erhalten Sie diese Grafik:

Beispiel

Wenn Sie die nachstehenden .0000 nicht möchten, ändern Sie einfach die Genauigkeit auf 0. Und wenn Sie die Werte in Ihrer nicht ändern möchten, \addplotsehen Sie sich die andere bereitgestellte Antwort an :)

verwandte Informationen