Re: RE: White border in plots
- To: mathgroup at smc.vnet.net
- Subject: [mg35455] Re: [mg35431] RE: [mg35404] White border in plots
- From: "Jonathan Rockmann" <MTheory at msn.com>
- Date: Sat, 13 Jul 2002 03:48:31 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Wolf and Tom, I tried the same experiments you both performed and in particular Wolf, if I use a green background instead of red on the code you gave I end up with a thin red line on bottom and right of your image whereas border of the original image with a green background still remains white. Windows 2000 and Mathematica 4.0 Jonathan mtheory at msn.com ----- Original Message ----- From: Wolf, Hartmut To: mathgroup at smc.vnet.net Subject: [mg35455] [mg35431] RE: [mg35404] White border in plots > -----Original Message----- > From: Thomas Manz [mailto:thomas.manz at physik.uni-regensburg.de] To: mathgroup at smc.vnet.net > Sent: Thursday, July 11, 2002 11:24 AM > Subject: [mg35455] [mg35431] [mg35404] White border in plots > > > Hello! > > I want to calculate some patterns but I always get artifacts. > The reason > seems to be the white border around the plots. If I calculate > 100 x 100 points > and plot or export them (see example below), the picture is > really 100 x 100 > pixels but with a white border. So my calculations are > 'squeezed' (some lines > and rows are missing!). > Does anyone have an idea how to get rid of this white border or will I > really have to export my tables to a textfile and use another > software zu produce > a bitmap-file?? > > > Example: > t = Table[Sin[(x + y)], {x, 0, 100}, {y, 0, 100}]; > Export["test.tif", > ListDensityPlot[t, Frame -> False, Mesh -> False, ImageSize -> {100, > 100}]] > > Thanks a lot for your help! > > Best regards > Thomas Manz > > > Thomas, I don't know whether this is of any help. The white margin you see is the rest of the plot region not filled by your density plot. You may recognize this, when you specify Background -> Hue[0] (now beeing red). Deplorably the Option Background -> None is only effective for Text objects. So I played for a while with the option PlotRange to have filled all of the range but nothing cut off from your plot, e.g. In[91]:= graph2 = ListDensityPlot[t, Frame -> False, Mesh -> False, PlotRegion -> {{0 - #1, 1 + #2}, {0 - #3, 1 + #4}}, Background -> Hue[0]] &[0.019, 0.019, 0.3, 0.3] The effects where not predictable (to me), especially I couldn't get rid off a small margin at the top or at the bottom. If #3 and #4 are great enough and equal (you can make them arbitrarily great) there remains a small margin at top and bottom as seen from Mathematica rendering. Exporting this as a .tif and looking at that from Microsoft Photo Editor, I saw the margins at bottom and right. Exporting to .eps and displaying with Ghostview gave a similar appearance to rendering within Mathematica . A short inspection of the .eps file makes me guess that there is some slight imprecision with the calculation of the bounding box and/or the scaling factor. Perhaps it is possible to fix the postscript and convert it to another format. But then it may appear to be easier to extract the gray values form the RasterGraphics and generate your graphic file by different means (perhaps not too difficult in your case). Possibly you will be content with the smallest margin possible (when you color it white, or better adapt it to the background of you final application). -- Hartmut