Dashed lines in graphs (and histograms) seem to differ in appearance for compiled and interpreted code and for different types of output files.
If the code is interpreted (using .L and then running at command line) the canvas displayed on the screen has the normal dashed line and the eps, png, and gif files all have the dashed line.
However, if the code is compiled and then run, the dashed line appears correctly in the eps file but in png and gif files, it appears as a solid line. Is there a way to make these lines appear dashed as well?
A sample piece of code demonstrating this is below. The code was run using:
root [0] .L graph.cc
root [1] main()
and also
g++ graph.cc root-config --cflags
root-config --libs
a.out
I used display to look at the png and gif files.
I am using Root version 5.14/00f under SLC4.
#include "TCanvas.h"
#include "TGraph.h"
#include<iostream>
#include<fstream>
int main()
{
TCanvas *c1 = new TCanvas("c2","Graph Canvas",250,50,700,700);
c1 -> Divide(1,1,0.01,0.01);
c1 -> cd(1);
const Int_t n = 20;
Double_t x[n], y1[n], y2[n];
for (Int_t i=0;i<n;i++) {
x[i] = i*0.1;
y1[i] = 10*sin(x[i]+0.2);
y2[i] = 5*sin(x[i]+0.5);
} //for
TGraph *graph1 = new TGraph(n,x,y1);
TGraph *graph2 = new TGraph(n,x,y2);
graph1 -> SetMarkerStyle(20);
graph1 -> SetMarkerColor(1);
graph1 -> SetLineStyle(1);
graph1 -> SetLineColor(1);
graph1 -> SetLineWidth(4);
graph1 -> Draw("APL");
graph2 -> SetMarkerStyle(21);
graph2 -> SetMarkerColor(2);
graph2 -> SetLineStyle(2);
graph2 -> SetLineColor(2);
graph2 -> SetLineWidth(4);
graph2 -> Draw("PL");
c1 -> Print("graph.eps","eps");
c1 -> Print("graph.png","png");
c1 -> Print("graph.gif","gif");
}