I have searched the forum for quite some time but only found in my opionion outdatet posts. Are there any changes for improving the image resolution in plots in a easy and convenient way? I.E. I would like to set an option when saving the canvas DPI=400 or something like that.
If you want “raster graphics”, in “batch mode”, you can directly create a canvas with any size (in pixels). Otherwise, your canvas’s windows size is basically limited to the size of your display (in pixels), but you can use the TCanvas::SetCanvasSize method to set any size (scroll bars may be added to the canvas’s window).
If you want “vector graphics”, you may want to play with the “PostScript output” (you can “cheat” in ROOT and increase the “paper size”, then “shrink” it outside of ROOT):
The last part is not correct. Even outside batch mode, you are not limited to the pixels of your display.
Both the window containing the canvas, and the canvas itself (inside that window), can be larger than the screen size. If the canvas is larger than the window, ROOT will just add scroll bars; if the canvas is larger than the screen, not all of it will be visible, just like any other window, but it can be resized just as well.
auto c = new TCanvas("c","c");
c->SetCanvasSize(1500, 1500); // even if your screen has smaller width/height
c->SetWindowSize(500, 500); // smaller than the canvas, so ROOT will add scroll bars
sorry that I didn’t reply for so long. You are absolutly right. Do you know how i can make a line like f(x) = x look not “pixelated” with eddges but smooth if you know what i mean. Increasing the resolution doesn’t seem to work for me here.
with best regards,
On screen, the same line may look “smooth” or ragged, depending on several factors, like the size of the canvas, angle of the line (aspect ratio), and thickness of the line. That’s because it is drawn as a raster image; to make it always smooth it has to be a vector. If you save it as a ps, eps or pdf, it will look smooth; if you save it as gif, png or jpg, it won’t. Compare the png and PDF versions of this: