Message Boards Message Boards

1
|
5057 Views
|
7 Replies
|
3 Total Likes
View groups...
Share
Share this post:
GROUPS:

PlotLegends and Graph blow out of proportions when rasterized

Posted 10 years ago

How can I make Rasterize to reproduce the graph and the legends in correct proportions? Thanks.

pl = Plot[Sin[x], {x, 0, 2 \[Pi]},  PlotRange -> Full, 
  AxesOrigin -> {0, 0}, PlotLegends -> names, PlotStyle -> Thick, 
  AxesStyle -> Directive[Black, 21], ImageSize -> Scaled[0.7]     ]

Rasterize[pl, RasterSize -> 3000, ImageSize -> 1000]
POSTED BY: Al Guy
7 Replies
Posted 10 years ago

The ImageSize -> Scaled[0.7] seem to be causing the problem.

POSTED BY: Al Guy

You are correct, that is what I said: "Provide a number for the ImageSize in pl."

POSTED BY: Sander Huisman

It's very easy, try this...

Plot[Sin[x], {x, 0, 2 \[Pi]}, ImageSize -> 300]
Rasterize[%, "Image", RasterSize -> 400]
Rasterize[%%, "Image", RasterSize -> 1000]

The ImageDimensions of the the Plots should be 400x and 1000x, but are visually similar, no change in relative tick size.

POSTED BY: Sander Huisman

Provide a number for the ImageSize in pl. Then use Rasterize using the "Image" second argument

Rasterize[pl,"Image",Rastersize-> ....]
POSTED BY: Sander Huisman

"Image" doesn't do anything for me (except turn graphics into an image) but reducing the rastersize works:

Rasterize[pl, RasterSize -> 1024, ImageSize -> 640]

Running 10.1 on windows 8.1

POSTED BY: Kay Herbert

It looks the same with or without the "Image" argument, but the result is different; an Image or a Graphics object... ImageSize in Rasterize is only the "print"size of the output, not the size of the original image before rasterizing. That i why you have to set the imagesize explicitly in the plot to be sure...

POSTED BY: Sander Huisman

outputs with image: 1. 3000x1000 3000x1000 2. 1000x600: 1000x600

POSTED BY: Kay Herbert
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract