pfgplot mit zwei y-Achsen

Tabellen und Grafiken erstellen und anordnen


Volker Racho
Forum-Anfänger
Forum-Anfänger
Beiträge: 14
Registriert: Di 15. Jul 2014, 18:59

pfgplot mit zwei y-Achsen

Beitrag von Volker Racho »

Hallo zusammen,

ich bin absolut neu hier und hoffe, dass mir irgendwer weiterhelfen kann, da ich absolut nicht weiterkomme. Ich erstelle Diagramme meiner Diplomarbeit mit Tex. Das klappt soweit ganz gut, allerdings stoße ich nun an meine Grenzen.

Ich möchte eine Grafik mit 2 Ordinaten erstellen. Diese Grafik wird auch ziemlich korrekt dargestellt. Allerdings ragt die Achsenbeschriftung und die Achenbezeichnung über den Textrand hinaus. Ich möchte, dass diese auf Textweite ausgegeben wird. Auch wenn ich eine Größe in [cm] vorgebe und diese mit einer einfachen Grafik vergleiche, steht die Beschriftung über. Eine manuelle Größenvorgabe durch Trial and error wollte ich gerne vermeiden. Ich hoffe, mein Minimalbeispiel ist korrekt und ausreichend.

Die Daten kommen aus .txt-Dateien, die ich leider nicht hochladen kann.

Ein zweites Problem ist, dass die linke Ordinate oben und unten jeweils einen grauen Teilstrich ausweist, der die Größe der Skalierungslinien hat. Auch dies geschieht nur, wenn ich zwei Ordinaten darstelle.

\documentclass[11pt,a4paper,oneside,chapterprefix,pointednumbers]{scrbook}

\usepackage{pgfplots} 
\usepackage{tikz}                     
\pgfplotsset{width=\textwidth, height = 0.4\textheight, compat=newest, minor tick style={black}, legend style={cells={anchor=west}}, every axis legend/.append style={at={(0.99,0.99)},anchor=north east}}



\begin{document}

\begin{figure}[htb]
\centering
\begin{tikzpicture}
	\begin{axis}[grid = major,
                xlabel near ticks,
                ylabel near ticks,
                xlabel = Temperatur {[\celcius]},
                ylabel = {aaa [\%]},
                xmin=0, xmax=550,
                ymin=400, ymax=700,
                x tick label style={/pgf/number format/1000 sep=}
                ]
        \addlegendentry{roh}
        \addplot[color = blue, mark = none] table {Datei.txt};
	\end{axis}
	\begin{axis}[ylabel near ticks,
                axis y line*=right, ylabel = {xxx [\%]},
                xmin=0, xmax=550,
                ymin=0, ymax=300,
                x tick label style={/pgf/number format/1000 sep=},
                legend style={at={(0.99,0.89)}}
                ]
        \addlegendentry{gebrannt}
        \addplot[color = red, mark = none] table {Datei1.txt};
	\end{axis}
\end{tikzpicture}
    \caption{Text}
    \end{figure}

\end{document}

Ich freue mich über jede Hilfe und Anregung zu diesem Thema, da ich sowohl im Netz, als auch im Manual nicht fündig werde. Danke im Voraus![/code]

Felix
Forum-Century
Forum-Century
Beiträge: 210
Registriert: Sa 25. Jan 2014, 13:57

Beitrag von Felix »

Hi Volker,

auf die Schnelle seh ich's nicht, doch eben noch ein Tipp für Quellen: pgfplots-Themen auf TeXwelt. Da kann man auch fragen, einige Experten mit Freunde am Plotten sind dort. Sehr bildhafter Eindruck: Plot Beispiele.

Felix

prankenandi
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 60
Registriert: Di 8. Apr 2014, 13:59

Beitrag von prankenandi »

Hallo Volker,

du kannst das filecontents-package nehmen um die Daten hinzufügen!
Vielleicht ist es besser lösbar wenn man den Graphen sieht?!?!
\documentclass[11pt,a4paper,oneside,chapterprefix,pointednumbers]{scrbook}

\usepackage{pgfplots}
\usepackage{tikz}                    
\pgfplotsset{width=\textwidth, height = 0.4\textheight, compat=newest, minor tick style={black}, legend style={cells={anchor=west}}, every axis legend/.append style={at={(0.99,0.99)},anchor=north east}}

\usepackage{filecontents}

\begin{filecontents*}{Datei.txt}
HIER SIND DIE DATEN!!!
\end{filecontents*}


\begin{document}

\begin{figure}[htb]
\centering
\begin{tikzpicture}
   \begin{axis}[grid = major,
                xlabel near ticks,
                ylabel near ticks,
                xlabel = Temperatur {[\celcius]},
                ylabel = {aaa [\%]},
                xmin=0, xmax=550,
                ymin=400, ymax=700,
                x tick label style={/pgf/number format/1000 sep=}
                ]
        \addlegendentry{roh}
        \addplot[color = blue, mark = none] table {Datei.txt};
   \end{axis}
   \begin{axis}[ylabel near ticks,
                axis y line*=right, ylabel = {xxx [\%]},
                xmin=0, xmax=550,
                ymin=0, ymax=300,
                x tick label style={/pgf/number format/1000 sep=},
                legend style={at={(0.99,0.89)}}
                ]
        \addlegendentry{gebrannt}
        \addplot[color = red, mark = none] table {Datei.txt};
   \end{axis}
\end{tikzpicture}
    \caption{Text}
    \end{figure}

\end{document} 
Debian 7 (Wheezy) mit Texlive 2013 und Texmaker

Volker Racho
Forum-Anfänger
Forum-Anfänger
Beiträge: 14
Registriert: Di 15. Jul 2014, 18:59

Beitrag von Volker Racho »

Danke für die schnellen Antworten. @felix: Diese Seite kenne ich bereits. Habe ich auf der Suche nach einer Lösung zu meinem Problem auch schon besucht. Dort zu fragen, wäre mein nächster Schritt. Aber danke für die Info.

@prankenandi: Ich hoffe dass das folgende Korrekt ist. ;-)
\begin{filecontents*}{Datei.txt}
25.0	691
27.4	654
29.7	641
32.1	629
34.5	619
36.9	615
39.2	606
41.6	596
44.0	594
46.4	585
48.7	579
51.1	574
53.5	570
55.9	566
58.2	564
60.6	563
63.0	557
65.4	556
67.7	554
70.1	549
72.5	547
74.9	545
77.2	544
79.6	544
82.0	542
84.4	539
86.7	536
89.1	535
91.5	533
93.9	532
96.2	531
98.6	529
101.0	528
103.4	527
105.7	526
108.1	527
110.5	527
112.9	525
115.2	523
117.6	523
120.0	523
122.4	522
124.7	521
127.1	521
129.5	520
131.9	519
134.2	519
136.6	518
139.0	517
141.4	517
143.7	516
146.1	516
148.5	515
150.9	515
153.2	514
155.6	515
158.0	515
146.1	516
148.5	515
150.9	515
153.2	514
155.6	515
158.0	515
160.4	514
162.7	514
165.1	513
167.5	513
169.9	512
172.2	512
174.6	512
177.0	513
179.4	512
181.7	512
184.1	512
186.5	512
188.9	511
191.2	511
193.6	511
196.0	511
198.4	510
200.7	511
203.1	511
205.5	511
207.9	510
210.2	510
212.6	510
215.0	511
217.4	510
219.7	510
222.1	510
224.5	509
226.9	509
229.2	509
231.6	509
234.0	508
236.4	508
238.7	508
241.1	509
243.5	508
245.9	508
248.2	508
250.6	508
253.0	507
255.4	508
257.7	508
260.1	508
262.5	507
264.9	507
267.2	507
269.6	507
272.0	506
274.4	507
276.7	507
279.1	506
281.5	506
283.9	506
286.2	506
288.6	506
291.0	506
293.4	506
295.7	505
298.1	505
300.5	505
302.9	505
305.2	505
307.6	504
310.0	504
312.4	504
314.7	505
317.1	504
321.9	505
324.2	504
326.6	504
329.0	504
331.4	504
333.7	504
336.1	504
338.5	504
340.9	504
343.2	503
345.6	503
348.0	503
350.4	503
352.7	503
355.1	503
357.5	503
359.9	503
362.2	503
364.6	503
367.0	503
369.4	503
371.7	502
374.1	503
376.5	503
378.9	502
381.2	503
383.6	504
386.0	504
388.4	502
390.7	502
393.1	501
395.5	501
397.9	502
400.2	502
402.6	502
405.0	501
407.4	501
409.7	502
412.1	502
414.5	502
416.9	502
419.2	501
421.6	501
424.0	501
426.4	501
428.7	501
431.1	501
433.5	502
435.9	503
438.2	502
440.6	502
443.0	503
445.4	502
447.7	503
450.1	503
452.5	503
454.9	502
457.2	501
459.6	501
462.0	501
464.4	502
466.7	502
469.1	501
471.5	501
473.9	502
476.2	502
478.6	503
483.4	503
485.7	503
488.1	502
490.5	502
492.9	502
495.2	502
497.6	502
500.0	503
500.0	503
500.0	503
497.7	501
495.4	501
493.2	500
490.9	500
488.6	501
486.3	500
484.0	499
481.8	499
479.5	497
477.2	496
474.9	496
472.6	496
470.4	496
468.1	495
465.8	494
463.5	494
461.2	495
459.0	495
456.7	494
454.4	493
452.1	492
449.8	492
447.6	491
445.3	492
443.0	491
440.7	490
438.4	489
436.2	489
433.9	488
431.6	488
429.3	489
427.0	488
424.8	488
422.5	488
420.2	487
417.9	485
415.6	485
413.4	486
411.1	485
408.8	484
406.5	484
404.2	483
402.0	485
399.7	486
397.4	485
395.1	483
392.8	483
390.6	482
388.3	481
386.0	482
383.7	482
381.4	480
379.2	479
376.9	479
374.6	478
372.3	479
370.0	480
365.5	478
363.2	477
360.9	477
358.6	475
356.4	475
354.1	476
351.8	476
349.5	474
347.2	474
345.0	474
342.7	472
340.4	472
338.1	473
335.8	474
333.6	473
331.3	473
329.0	473
326.7	471
324.4	472
322.2	472
319.9	472
317.6	471
315.3	470
313.0	470
310.8	469
308.5	467
306.2	469
303.9	469
301.6	469
299.4	469
297.1	468
294.8	467
292.5	466
290.2	466
288.0	467
285.7	467
283.4	465
281.1	466
278.8	466
276.6	466
274.3	466
272.0	466
269.7	465
267.4	465
265.2	465
262.9	464
260.6	464
258.3	464
256.0	463
253.8	463
251.5	463
249.2	463
246.9	463
244.6	463
242.4	462
240.1	462
237.8	462
235.5	462
233.2	462
231.0	462
228.7	461
226.4	461
224.1	461
221.8	461
219.6	461
217.3	461
215.0	461
210.4	459
208.2	459
205.9	460
203.6	460
201.3	460
199.0	459
196.8	459
194.5	459
192.2	459
189.9	458
187.6	458
185.4	460
183.1	460
180.8	460
178.5	460
176.2	459
174.0	460
171.7	460
169.4	459
167.1	460
164.8	461
162.6	461
160.3	460
158.0	461
155.7	461
153.4	460
151.2	461
148.9	462
146.6	461
144.3	461
142.0	460
139.8	462
137.5	463
135.2	462
132.9	463
130.6	463
128.4	463
126.1	463
123.8	464
121.5	465
119.2	466
117.0	467
114.7	468
112.4	466
110.1	466
107.8	469
105.6	470
103.3	471
101.0	472
98.7	471
96.4	472
94.2	475
91.9	477
89.6	476
87.3	478
85.0	479
82.8	481
80.5	480
78.2	483
75.9	487
73.6	488
71.4	488
69.1	490
66.8	492
64.5	495
62.2	498
60.0	501
55.4	508
53.1	508
50.8	513
48.6	519
46.3	520
44.0	529
41.7	534
39.4	537
37.2	545
34.9	548
32.6	554
30.3	566
28.0	585
25.8	595
25.0	599
\end{filecontents*} 

\begin{filecontents*}{Datei1.txt}

25.0	17.3
27.4	17.9
29.7	19.1
32.1	20.2
34.5	21.3
36.9	22.7
39.2	23.8
41.6	24.8
44.0	26.2
46.4	27.2
48.7	28.2
51.1	29.3
53.5	30.5
55.9	31.6
58.2	32.9
60.6	34.2
63.0	35.1
65.4	36.4
67.7	37.5
70.1	38.5
72.5	39.6
74.9	40.8
77.2	42
79.6	43.3
82.0	44.5
84.4	45.5
86.7	46.5
89.1	47.6
91.5	48.8
93.9	49.9
96.2	51.1
98.6	52.2
101.0	53.4
103.4	54.5
105.7	55.7
108.1	57
110.5	58.2
112.9	59.2
115.2	60.2
117.6	61.6
120.0	62.8
122.4	63.9
124.7	65.1
127.1	66.2
129.5	67.3
131.9	68.5
134.2	69.6
136.6	70.8
139.0	71.9
141.4	73.1
143.7	74.2
146.1	75.3
148.5	76.5
150.9	77.6
153.2	78.8
155.6	80.1
158.0	81.3
146.1	75.3
148.5	76.5
150.9	77.6
153.2	78.8
155.6	80.1
158.0	81.3
160.4	82.5
162.7	83.6
165.1	84.7
167.5	85.9
169.9	87
172.2	88.2
174.6	89.5
177.0	90.7
179.4	91.9
181.7	93
184.1	94.3
186.5	95.5
188.9	96.4
191.2	97.8
193.6	99
196.0	100.1
198.4	101.3
200.7	102.6
203.1	103.8
205.5	105
207.9	106.1
210.2	107.2
212.6	108.5
215.0	109.8
217.4	110.9
219.7	112.1
222.1	113.2
224.5	114.4
226.9	115.5
229.2	116.6
231.6	117.8
234.0	118.9
236.4	120.1
238.7	121.3
241.1	122.6
243.5	123.8
245.9	124.9
248.2	126.2
250.6	127.4
253.0	128.4
255.4	129.6
257.7	130.9
260.1	132
262.5	133.2
264.9	134.3
267.2	135.4
269.6	136.6
272.0	137.7
274.4	139
276.7	140.2
279.1	141.2
281.5	142.3
283.9	143.6
286.2	144.9
288.6	146
291.0	147.3
293.4	148.4
295.7	149.4
298.1	150.6
300.5	151.7
302.9	153
305.2	154.2
307.6	155.2
310.0	156.3
312.4	157.5
314.7	158.8
317.1	160
321.9	162.4
324.2	163.4
326.6	164.7
329.0	165.9
331.4	167.1
333.7	168.2
336.1	169.4
338.5	170.5
340.9	171.7
343.2	172.8
345.6	173.9
348.0	175.1
350.4	176.2
352.7	177.4
355.1	178.5
357.5	179.8
359.9	181.1
362.2	182.2
364.6	183.4
367.0	184.5
369.4	185.6
371.7	186.8
374.1	188.1
376.5	189.2
378.9	190.2
381.2	192
383.6	193.5
386.0	194.7
388.4	195
390.7	196
393.1	197.1
395.5	198.3
397.9	199.6
400.2	200.9
402.6	201.9
405.0	202.8
407.4	204.2
409.7	205.8
412.1	207
414.5	207.9
416.9	209.5
419.2	210.2
421.6	211
424.0	212.2
426.4	213.7
428.7	214.8
431.1	216.1
433.5	217.8
435.9	219.1
438.2	220.1
440.6	221.1
443.0	222.6
445.4	223.6
447.7	225
450.1	226.6
452.5	227.7
454.9	228.3
457.2	229.2
459.6	230.4
462.0	231.5
464.4	233
466.7	234.2
469.1	235.2
471.5	236.3
473.9	237.8
476.2	239.2
478.6	240.6
483.4	243.4
485.7	244.5
488.1	245.1
490.5	246.3
492.9	247.3
495.2	248.4
497.6	249.9
500.0	251.5
500.0	251.6
500.0	251.6
497.7	249.5
495.4	248
493.2	246.7
490.9	245.2
488.6	244.6
486.3	243.2
484.0	241.5
481.8	240.3
479.5	238.5
477.2	236.8
474.9	235.4
472.6	234.7
470.4	233.1
468.1	231.6
465.8	230.3
463.5	228.9
461.2	228.2
459.0	227.2
456.7	225.7
454.4	224.2
452.1	222.6
449.8	221.2
447.6	219.8
445.3	219.1
443.0	217.7
440.7	216
438.4	214.5
436.2	213.2
433.9	211.7
431.6	210.4
429.3	209.8
427.0	208.5
424.8	207.2
422.5	206.1
420.2	204.4
417.9	202.9
415.6	201.8
413.4	201.1
411.1	199.2
408.8	198
406.5	196.8
404.2	195.3
402.0	194.9
399.7	194.2
397.4	192.8
395.1	190.7
392.8	189.6
390.6	188.2
388.3	186.9
386.0	186.1
383.7	184.8
381.4	183.3
379.2	181.7
376.9	180.5
374.6	179.2
372.3	178.3
370.0	177.6
365.5	174.8
363.2	173.4
360.9	172.2
358.6	170.5
356.4	169.3
354.1	168.4
351.8	167.4
349.5	165.7
347.2	164.5
345.0	163.4
342.7	161.9
340.4	160.7
338.1	159.9
335.8	159.1
333.6	157.8
331.3	156.8
329.0	155.5
326.7	153.9
324.4	153.1
322.2	152.2
319.9	151
317.6	149.5
315.3	148.2
313.0	147
310.8	145.7
308.5	144.2
306.2	143.6
303.9	142.7
301.6	141.5
299.4	140.4
297.1	139
294.8	137.6
292.5	136.2
290.2	135.3
288.0	134.5
285.7	133.3
283.4	131.9
281.1	130.9
278.8	130
276.6	128.9
274.3	127.8
272.0	126.7
269.7	125.5
267.4	124.4
265.2	123.2
262.9	122.1
260.6	120.9
258.3	119.8
256.0	118.7
253.8	117.5
251.5	116.4
249.2	115.3
246.9	114.3
244.6	113.2
242.4	112.1
240.1	110.9
237.8	109.8
235.5	108.8
233.2	107.7
231.0	106.6
228.7	105.5
226.4	104.3
224.1	103.3
221.8	102.3
219.6	101.1
217.3	100.1
215.0	99.1
210.4	96.6
208.2	95.6
205.9	94.6
203.6	93.7
201.3	92.5
199.0	91.4
196.8	90.3
194.5	89.3
192.2	88.2
189.9	87.1
187.6	86
185.4	85.2
183.1	84.1
180.8	83.1
178.5	82.1
176.2	81
174.0	80
171.7	78.9
169.4	77.8
167.1	76.9
164.8	75.9
162.6	74.9
160.3	73.7
158.0	72.8
155.7	71.7
153.4	70.6
151.2	69.7
148.9	68.7
146.6	67.7
144.3	66.5
142.0	65.4
139.8	64.6
137.5	63.6
135.2	62.5
132.9	61.5
130.6	60.4
128.4	59.4
126.1	58.4
123.8	57.5
121.5	56.5
119.2	55.6
117.0	54.6
114.7	53.7
112.4	52.4
110.1	51.3
107.8	50.5
105.6	49.6
103.3	48.6
101.0	47.6
98.7	46.5
96.4	45.5
94.2	44.7
91.9	43.8
89.6	42.7
87.3	41.7
85.0	40.8
82.8	39.8
80.5	38.6
78.2	37.8
75.9	36.9
73.6	36
71.4	34.8
69.1	33.8
66.8	32.9
64.5	31.9
62.2	31
60.0	30
55.4	28.1
53.1	27
50.8	26.1
48.6	25.2
46.3	24.1
44.0	23.3
41.7	22.3
39.4	21.2
37.2	20.2
34.9	19.1
32.6	18.1
30.3	17.2
28.0	16.4
25.8	15.3
25.0	15


\end{filecontents*}

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

In deinem Code steht
\pgfplotsset{width=\textwidth,...}
Wenn man sich in der Doku die Infos zur Option width durchliest, dann erfährt man, dass der für width angegebene Wert nur näherungsweise erreicht wird.

Von der angegebenen Breite werden 45pt für die Beschriftung reserviert und der Rest wird für die eigentliche Plotbox verwendet. Diese ist dann also unabhängig von der Beschriftung \textwidth-45pt breit. Da du beide Achsen beschriftest, braucht die Beschriftung mehr als 45pt und steht damit über.

Gruß
Elke

Volker Racho
Forum-Anfänger
Forum-Anfänger
Beiträge: 14
Registriert: Di 15. Jul 2014, 18:59

Beitrag von Volker Racho »

Nun bin ich um einiges schlauer! Das ist mir nicht aufgefallen. Gibt es denn eine Möglichkeit dieses Problem zu beseitigen?

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Mit
 \resizebox{\textwidth}{!}{...}
kannst du das gesamte tikzpicture auf \textwidth skalieren. Allerdings wird die Schrift mitskaliert, weshalb ich vorher width etwas von Hand anpassen würde, zum Beispiel auf 0.9\textwidth

Gruß
Elke

prankenandi
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 60
Registriert: Di 8. Apr 2014, 13:59

Beitrag von prankenandi »

Also bei mir steht dein Plot 42pt über, also hab ich ihn um 45pt kleiner gemacht und auch so noch 1,2 kleine Veränderungen an deinem Code vorgenommen.
\documentclass[11pt,a4paper,oneside,chapterprefix,pointednumbers]{scrbook}

\usepackage{pgfplots}
\pgfplotsset{compat=newest,
			minor tick style={black},}

\usepgfplotslibrary{units}

\usepackage{siunitx}


\usepackage{filecontents}

\begin{filecontents*}{Datei.txt}
25.0   691
27.4   654
29.7   641
32.1   629
34.5   619
36.9   615
39.2   606
41.6   596
44.0   594
46.4   585
48.7   579
51.1   574
53.5   570
55.9   566
58.2   564
60.6   563
63.0   557
65.4   556
67.7   554
70.1   549
72.5   547
74.9   545
77.2   544
79.6   544
82.0   542
84.4   539
86.7   536
89.1   535
91.5   533
93.9   532
96.2   531
98.6   529
101.0   528
103.4   527
105.7   526
108.1   527
110.5   527
112.9   525
115.2   523
117.6   523
120.0   523
122.4   522
124.7   521
127.1   521
129.5   520
131.9   519
134.2   519
136.6   518
139.0   517
141.4   517
143.7   516
146.1   516
148.5   515
150.9   515
153.2   514
155.6   515
158.0   515
146.1   516
148.5   515
150.9   515
153.2   514
155.6   515
158.0   515
160.4   514
162.7   514
165.1   513
167.5   513
169.9   512
172.2   512
174.6   512
177.0   513
179.4   512
181.7   512
184.1   512
186.5   512
188.9   511
191.2   511
193.6   511
196.0   511
198.4   510
200.7   511
203.1   511
205.5   511
207.9   510
210.2   510
212.6   510
215.0   511
217.4   510
219.7   510
222.1   510
224.5   509
226.9   509
229.2   509
231.6   509
234.0   508
236.4   508
238.7   508
241.1   509
243.5   508
245.9   508
248.2   508
250.6   508
253.0   507
255.4   508
257.7   508
260.1   508
262.5   507
264.9   507
267.2   507
269.6   507
272.0   506
274.4   507
276.7   507
279.1   506
281.5   506
283.9   506
286.2   506
288.6   506
291.0   506
293.4   506
295.7   505
298.1   505
300.5   505
302.9   505
305.2   505
307.6   504
310.0   504
312.4   504
314.7   505
317.1   504
321.9   505
324.2   504
326.6   504
329.0   504
331.4   504
333.7   504
336.1   504
338.5   504
340.9   504
343.2   503
345.6   503
348.0   503
350.4   503
352.7   503
355.1   503
357.5   503
359.9   503
362.2   503
364.6   503
367.0   503
369.4   503
371.7   502
374.1   503
376.5   503
378.9   502
381.2   503
383.6   504
386.0   504
388.4   502
390.7   502
393.1   501
395.5   501
397.9   502
400.2   502
402.6   502
405.0   501
407.4   501
409.7   502
412.1   502
414.5   502
416.9   502
419.2   501
421.6   501
424.0   501
426.4   501
428.7   501
431.1   501
433.5   502
435.9   503
438.2   502
440.6   502
443.0   503
445.4   502
447.7   503
450.1   503
452.5   503
454.9   502
457.2   501
459.6   501
462.0   501
464.4   502
466.7   502
469.1   501
471.5   501
473.9   502
476.2   502
478.6   503
483.4   503
485.7   503
488.1   502
490.5   502
492.9   502
495.2   502
497.6   502
500.0   503
500.0   503
500.0   503
497.7   501
495.4   501
493.2   500
490.9   500
488.6   501
486.3   500
484.0   499
481.8   499
479.5   497
477.2   496
474.9   496
472.6   496
470.4   496
468.1   495
465.8   494
463.5   494
461.2   495
459.0   495
456.7   494
454.4   493
452.1   492
449.8   492
447.6   491
445.3   492
443.0   491
440.7   490
438.4   489
436.2   489
433.9   488
431.6   488
429.3   489
427.0   488
424.8   488
422.5   488
420.2   487
417.9   485
415.6   485
413.4   486
411.1   485
408.8   484
406.5   484
404.2   483
402.0   485
399.7   486
397.4   485
395.1   483
392.8   483
390.6   482
388.3   481
386.0   482
383.7   482
381.4   480
379.2   479
376.9   479
374.6   478
372.3   479
370.0   480
365.5   478
363.2   477
360.9   477
358.6   475
356.4   475
354.1   476
351.8   476
349.5   474
347.2   474
345.0   474
342.7   472
340.4   472
338.1   473
335.8   474
333.6   473
331.3   473
329.0   473
326.7   471
324.4   472
322.2   472
319.9   472
317.6   471
315.3   470
313.0   470
310.8   469
308.5   467
306.2   469
303.9   469
301.6   469
299.4   469
297.1   468
294.8   467
292.5   466
290.2   466
288.0   467
285.7   467
283.4   465
281.1   466
278.8   466
276.6   466
274.3   466
272.0   466
269.7   465
267.4   465
265.2   465
262.9   464
260.6   464
258.3   464
256.0   463
253.8   463
251.5   463
249.2   463
246.9   463
244.6   463
242.4   462
240.1   462
237.8   462
235.5   462
233.2   462
231.0   462
228.7   461
226.4   461
224.1   461
221.8   461
219.6   461
217.3   461
215.0   461
210.4   459
208.2   459
205.9   460
203.6   460
201.3   460
199.0   459
196.8   459
194.5   459
192.2   459
189.9   458
187.6   458
185.4   460
183.1   460
180.8   460
178.5   460
176.2   459
174.0   460
171.7   460
169.4   459
167.1   460
164.8   461
162.6   461
160.3   460
158.0   461
155.7   461
153.4   460
151.2   461
148.9   462
146.6   461
144.3   461
142.0   460
139.8   462
137.5   463
135.2   462
132.9   463
130.6   463
128.4   463
126.1   463
123.8   464
121.5   465
119.2   466
117.0   467
114.7   468
112.4   466
110.1   466
107.8   469
105.6   470
103.3   471
101.0   472
98.7   471
96.4   472
94.2   475
91.9   477
89.6   476
87.3   478
85.0   479
82.8   481
80.5   480
78.2   483
75.9   487
73.6   488
71.4   488
69.1   490
66.8   492
64.5   495
62.2   498
60.0   501
55.4   508
53.1   508
50.8   513
48.6   519
46.3   520
44.0   529
41.7   534
39.4   537
37.2   545
34.9   548
32.6   554
30.3   566
28.0   585
25.8   595
25.0   599
\end{filecontents*}

\begin{filecontents*}{Datei1.txt}
25.0   17.3
27.4   17.9
29.7   19.1
32.1   20.2
34.5   21.3
36.9   22.7
39.2   23.8
41.6   24.8
44.0   26.2
46.4   27.2
48.7   28.2
51.1   29.3
53.5   30.5
55.9   31.6
58.2   32.9
60.6   34.2
63.0   35.1
65.4   36.4
67.7   37.5
70.1   38.5
72.5   39.6
74.9   40.8
77.2   42
79.6   43.3
82.0   44.5
84.4   45.5
86.7   46.5
89.1   47.6
91.5   48.8
93.9   49.9
96.2   51.1
98.6   52.2
101.0   53.4
103.4   54.5
105.7   55.7
108.1   57
110.5   58.2
112.9   59.2
115.2   60.2
117.6   61.6
120.0   62.8
122.4   63.9
124.7   65.1
127.1   66.2
129.5   67.3
131.9   68.5
134.2   69.6
136.6   70.8
139.0   71.9
141.4   73.1
143.7   74.2
146.1   75.3
148.5   76.5
150.9   77.6
153.2   78.8
155.6   80.1
158.0   81.3
146.1   75.3
148.5   76.5
150.9   77.6
153.2   78.8
155.6   80.1
158.0   81.3
160.4   82.5
162.7   83.6
165.1   84.7
167.5   85.9
169.9   87
172.2   88.2
174.6   89.5
177.0   90.7
179.4   91.9
181.7   93
184.1   94.3
186.5   95.5
188.9   96.4
191.2   97.8
193.6   99
196.0   100.1
198.4   101.3
200.7   102.6
203.1   103.8
205.5   105
207.9   106.1
210.2   107.2
212.6   108.5
215.0   109.8
217.4   110.9
219.7   112.1
222.1   113.2
224.5   114.4
226.9   115.5
229.2   116.6
231.6   117.8
234.0   118.9
236.4   120.1
238.7   121.3
241.1   122.6
243.5   123.8
245.9   124.9
248.2   126.2
250.6   127.4
253.0   128.4
255.4   129.6
257.7   130.9
260.1   132
262.5   133.2
264.9   134.3
267.2   135.4
269.6   136.6
272.0   137.7
274.4   139
276.7   140.2
279.1   141.2
281.5   142.3
283.9   143.6
286.2   144.9
288.6   146
291.0   147.3
293.4   148.4
295.7   149.4
298.1   150.6
300.5   151.7
302.9   153
305.2   154.2
307.6   155.2
310.0   156.3
312.4   157.5
314.7   158.8
317.1   160
321.9   162.4
324.2   163.4
326.6   164.7
329.0   165.9
331.4   167.1
333.7   168.2
336.1   169.4
338.5   170.5
340.9   171.7
343.2   172.8
345.6   173.9
348.0   175.1
350.4   176.2
352.7   177.4
355.1   178.5
357.5   179.8
359.9   181.1
362.2   182.2
364.6   183.4
367.0   184.5
369.4   185.6
371.7   186.8
374.1   188.1
376.5   189.2
378.9   190.2
381.2   192
383.6   193.5
386.0   194.7
388.4   195
390.7   196
393.1   197.1
395.5   198.3
397.9   199.6
400.2   200.9
402.6   201.9
405.0   202.8
407.4   204.2
409.7   205.8
412.1   207
414.5   207.9
416.9   209.5
419.2   210.2
421.6   211
424.0   212.2
426.4   213.7
428.7   214.8
431.1   216.1
433.5   217.8
435.9   219.1
438.2   220.1
440.6   221.1
443.0   222.6
445.4   223.6
447.7   225
450.1   226.6
452.5   227.7
454.9   228.3
457.2   229.2
459.6   230.4
462.0   231.5
464.4   233
466.7   234.2
469.1   235.2
471.5   236.3
473.9   237.8
476.2   239.2
478.6   240.6
483.4   243.4
485.7   244.5
488.1   245.1
490.5   246.3
492.9   247.3
495.2   248.4
497.6   249.9
500.0   251.5
500.0   251.6
500.0   251.6
497.7   249.5
495.4   248
493.2   246.7
490.9   245.2
488.6   244.6
486.3   243.2
484.0   241.5
481.8   240.3
479.5   238.5
477.2   236.8
474.9   235.4
472.6   234.7
470.4   233.1
468.1   231.6
465.8   230.3
463.5   228.9
461.2   228.2
459.0   227.2
456.7   225.7
454.4   224.2
452.1   222.6
449.8   221.2
447.6   219.8
445.3   219.1
443.0   217.7
440.7   216
438.4   214.5
436.2   213.2
433.9   211.7
431.6   210.4
429.3   209.8
427.0   208.5
424.8   207.2
422.5   206.1
420.2   204.4
417.9   202.9
415.6   201.8
413.4   201.1
411.1   199.2
408.8   198
406.5   196.8
404.2   195.3
402.0   194.9
399.7   194.2
397.4   192.8
395.1   190.7
392.8   189.6
390.6   188.2
388.3   186.9
386.0   186.1
383.7   184.8
381.4   183.3
379.2   181.7
376.9   180.5
374.6   179.2
372.3   178.3
370.0   177.6
365.5   174.8
363.2   173.4
360.9   172.2
358.6   170.5
356.4   169.3
354.1   168.4
351.8   167.4
349.5   165.7
347.2   164.5
345.0   163.4
342.7   161.9
340.4   160.7
338.1   159.9
335.8   159.1
333.6   157.8
331.3   156.8
329.0   155.5
326.7   153.9
324.4   153.1
322.2   152.2
319.9   151
317.6   149.5
315.3   148.2
313.0   147
310.8   145.7
308.5   144.2
306.2   143.6
303.9   142.7
301.6   141.5
299.4   140.4
297.1   139
294.8   137.6
292.5   136.2
290.2   135.3
288.0   134.5
285.7   133.3
283.4   131.9
281.1   130.9
278.8   130
276.6   128.9
274.3   127.8
272.0   126.7
269.7   125.5
267.4   124.4
265.2   123.2
262.9   122.1
260.6   120.9
258.3   119.8
256.0   118.7
253.8   117.5
251.5   116.4
249.2   115.3
246.9   114.3
244.6   113.2
242.4   112.1
240.1   110.9
237.8   109.8
235.5   108.8
233.2   107.7
231.0   106.6
228.7   105.5
226.4   104.3
224.1   103.3
221.8   102.3
219.6   101.1
217.3   100.1
215.0   99.1
210.4   96.6
208.2   95.6
205.9   94.6
203.6   93.7
201.3   92.5
199.0   91.4
196.8   90.3
194.5   89.3
192.2   88.2
189.9   87.1
187.6   86
185.4   85.2
183.1   84.1
180.8   83.1
178.5   82.1
176.2   81
174.0   80
171.7   78.9
169.4   77.8
167.1   76.9
164.8   75.9
162.6   74.9
160.3   73.7
158.0   72.8
155.7   71.7
153.4   70.6
151.2   69.7
148.9   68.7
146.6   67.7
144.3   66.5
142.0   65.4
139.8   64.6
137.5   63.6
135.2   62.5
132.9   61.5
130.6   60.4
128.4   59.4
126.1   58.4
123.8   57.5
121.5   56.5
119.2   55.6
117.0   54.6
114.7   53.7
112.4   52.4
110.1   51.3
107.8   50.5
105.6   49.6
103.3   48.6
101.0   47.6
98.7   46.5
96.4   45.5
94.2   44.7
91.9   43.8
89.6   42.7
87.3   41.7
85.0   40.8
82.8   39.8
80.5   38.6
78.2   37.8
75.9   36.9
73.6   36
71.4   34.8
69.1   33.8
66.8   32.9
64.5   31.9
62.2   31
60.0   30
55.4   28.1
53.1   27
50.8   26.1
48.6   25.2
46.3   24.1
44.0   23.3
41.7   22.3
39.4   21.2
37.2   20.2
34.9   19.1
32.6   18.1
30.3   17.2
28.0   16.4
25.8   15.3
25.0   15


\end{filecontents*} 


\begin{document}

\begin{figure}[htb]
\centering
\begin{tikzpicture}
%
\pgfplotsset{set layers,
			ticklabel shift={0.05cm},
			width=\textwidth-45pt,
			height = 0.4\textheight
			}
%			
   \begin{axis}[grid = major,
                xlabel near ticks,
                ylabel near ticks,
                xlabel = {Temperatur},
                x unit=\si{\degreeCelsius},
                ylabel = {aaa},
                y unit=\si{\percent},
                xmin=0, xmax=550,
                ymin=400, ymax=700,
                x tick label style={/pgf/number format/1000 sep=}
                ]
                \addplot[color = blue, mark = none,] table {Datei.txt};
                \label{roh}
   \end{axis}
   \begin{axis}[ylabel near ticks,
                axis y line*=right,
                 ylabel = {xxx},
                 y unit=\si{\percent},
                xmin=0, xmax=550,
                ymin=0, ymax=300,
                x tick label style={/pgf/number format/1000 sep=},
                legend pos=south east,
                legend cell align=left,
                ]
                \addplot[color = red, mark = none] table {Datei1.txt};
        \addlegendimage{/pgfplots/refstyle=roh}
        \addlegendentry{roh}
        \addlegendentry{gebrannt}
   \end{axis}
\end{tikzpicture}
    \caption{Text}
    \end{figure}

\end{document} 
Debian 7 (Wheezy) mit Texlive 2013 und Texmaker

Volker Racho
Forum-Anfänger
Forum-Anfänger
Beiträge: 14
Registriert: Di 15. Jul 2014, 18:59

Beitrag von Volker Racho »

Habe es nun einfach mit
width = \textwidth-45pt

innerhalb der axis-umgebung gelöst. So ist es denk ich am einfachsten.

Wenn ich mit \resize arbeite, verändere ich mir doch auch die anderen Diagramme ohne zweite Achse, oder nicht?! Wenn jemand nun natürlich noch eine bessere Lösung parat hält, bin ich natürlich offen.

Was allerdings diese grauen Abstufungen in der linken Ordinate angeht, bin ich immer noch ratlos.

Vielen Dank nochmal für die vielen Antworten. Ich bin begeistert, wie schnell und hilfreich dieses Forum ist.

Volker Racho
Forum-Anfänger
Forum-Anfänger
Beiträge: 14
Registriert: Di 15. Jul 2014, 18:59

Beitrag von Volker Racho »

Ich sehe, prankenandi hatte die gleich Idee! ;-)

Dankeschön!!!

Antworten