MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Issues with Rendering of Graphics[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129948] Issues with Rendering of Graphics[]
  • From: tim_brock20 at hotmail.com
  • Date: Wed, 27 Feb 2013 23:42:54 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Hi

I've been trying to design a bar chart from scratch using primitives. I've come across a bit of an odd issue when I try to add horizontal lines across vertical bars as an alternative to grid lines.

The list rectangles looks like the following:
{Rectangle[{0.1, 0}, {0.9, 35}], Rectangle[{1.1, 0}, {1.9, 89}],
 Rectangle[{2.1, 0}, {2.9, 9}], Rectangle[{3.1, 0}, {3.9, 57}],
 Rectangle[{4.1, 0}, {4.9, 88}], Rectangle[{5.1, 0}, {5.9, 51}],
 Rectangle[{6.1, 0}, {6.9, 52}], Rectangle[{7.1, 0}, {7.9, 62}],
 Rectangle[{8.1, 0}, {8.9, 78}], Rectangle[{9.1, 0}, {9.9, 50}]}

The list markers20 looks like the following:
{{Line[{{0.1, 20}, {0.9, 20}}]}, {Line[{{1.1, 20}, {1.9, 20}}],
  Line[{{1.1, 40}, {1.9, 40}}], Line[{{1.1, 60}, {1.9, 60}}],
  Line[{{1.1, 80}, {1.9, 80}}]}, {}, {Line[{{3.1, 20}, {3.9, 20}}],
  Line[{{3.1, 40}, {3.9, 40}}]}, {Line[{{4.1, 20}, {4.9, 20}}],
  Line[{{4.1, 40}, {4.9, 40}}], Line[{{4.1, 60}, {4.9, 60}}],
  Line[{{4.1, 80}, {4.9, 80}}]}, {Line[{{5.1, 20}, {5.9, 20}}],
  Line[{{5.1, 40}, {5.9, 40}}]}, {Line[{{6.1, 20}, {6.9, 20}}],
  Line[{{6.1, 40}, {6.9, 40}}]}, {Line[{{7.1, 20}, {7.9, 20}}],
  Line[{{7.1, 40}, {7.9, 40}}],
  Line[{{7.1, 60}, {7.9, 60}}]}, {Line[{{8.1, 20}, {8.9, 20}}],
  Line[{{8.1, 40}, {8.9, 40}}],
  Line[{{8.1, 60}, {8.9, 60}}]}, {Line[{{9.1, 20}, {9.9, 20}}],
  Line[{{9.1, 40}, {9.9, 40}}]}}

And I use the following command to draw:

 Graphics[
 {
  RGBColor[136/255, 189/255, 204/255],
  rectangles,
  GrayLevel[0.25],
  CapForm["Butt"],
  markers20
  },
 PlotRange -> {{-1, 11}, {-10, 100}}, AspectRatio -> 1,
 ImageSize -> 600
 ]

The problem I'm having is that the horizontal markers which should stretch exactly from the left of a bar to the right of a bar are rendered as starting slightly inside of the bar on the left-hand side and go slightly outside on the right-hand side. I've tried changing the CapForm for the lines but that doesn't fix the problem.
Oddly, if I wrap the above inside of Image[] the problem goes away but in eneral I don't want to do this.
I'm using Mathematica 9.0.1.



  • Prev by Date: (Curious) behavior of Reap
  • Next by Date: Re: Saving mov in v9
  • Previous by thread: (Curious) behavior of Reap
  • Next by thread: Re: Saving mov in v9