Problem with plotting with legend of dashed line

Hi, I am using Octave 6.3(windows version) to plot some figures. I find the dashed line in the legend box is too short (one and a half short line) when display in the Figure windows or output as vector image “eps, pdf, svg”. However, when output as bitmap image(tif, png), it is OK(three short line). It is important to display the right dashed line in the legend box for ambiguous key will make the figure unclear.

Screenshot:

56B824191FA540379C531B3B0BA3232C.png

Png:

985870B935B345BFACD76C264893EE07.png

Svg:

C144B73EB05C4FB8A60F21359B3EBC6C.png

Also I find the intervals of the dashed line between vector and bitmap format are not the same. It seemes the intervals of vector images are larger. I hope the images can give the same thing for all format. I am wondering how I can control this.

Here is the test code:

x=-pi:0.1:pi;

figure(10)

plot(x,sin(x),’–’,x,cos(x),’-.’,x,sin(x)+cos(x),’:’)

legend(‘sin’,‘cos’,‘sin’)

figfile=[‘plottest’];

saveas(10,[figfile,’.tiff’]);

saveas(10,[figfile,’.png’]);

print(10,[figfile,’.eps’],’-depsc’);

saveas(10,[figfile,’.svg’])

saveas(10,[figfile,‘2.eps’])

saveas(10,[figfile,’.pdf’])

Sorry for my poor English. Thank you very much for your help!

Code blocks need to start and end with this sequence “```” (without the quotes) so that the web site doesn’t change the code. Here is the desired code.

x=-pi:0.1:pi;

figure(10)

plot(x,sin(x),'-',x,cos(x),'-.',x,sin(x)+cos(x),':')

legend('sin','cos','sin')

figfile=['plottest'];

saveas(10,[figfile,'.tiff']);

saveas(10,[figfile,'.png']);

print(10,[figfile,'.eps'],'-depsc');

saveas(10,[figfile,'.svg'])

saveas(10,[figfile,'2.eps'])

saveas(10,[figfile,'.pdf'])

Also, attached here: tst_lineout.m (317 Bytes)

The legend appears correctly for me, but I am running Linux. It may be that you have hardware-accelerated OpenGL and that it is the graphics card that has a problem.

My rendering of the eps file is shown below:

plottest.eps (11.4 KB)