Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.1K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Show[ ] doesn't produce one of inputs graphics?

Posted 4 years ago

I have a graphics object stored in variable g1 that was generated using ListLinePlot. It consists of data imported from a csv file and has some options setting like PlotRange, TicksStyle, AxesStyle and ImageSize.

Now I want to add some graphics primitives to it such as lines and rectangles.

So what I tried was

Show [ { g1, Graphics[{some primitives}] } ]

But nothing shows up. I tried it on a more simple plot - Plot[Sin[x],{x,-1,1}] - and I did manage to see the lines and rectangles.

I am also aware of the "down direction is minus y coordinate" issue.

Is there something I am missing here? Perhaps something about layers and object over object precedence?

I uploaded the notebook with g1.

Attachments:
POSTED BY: Ehud Behar
3 Replies
Posted 4 years ago

@ Gianluca Gorni and @ Rohit Namjoshi ,

Mistake for me. I gave different names for the horizontal ticks and vertical ticks. The horizontal span in my g1 plot is actually from 1.14 10^-2 sec to 1.16*10^-2 sec (and not from 11.4 sec to 11.6 sec), therefore drawing a circle with its center at {1,1} compresses the whole information to a short horizontal band. Same manipulation was made to the vertical axis.

Therfore, I am going to use the ImageScale function to draw my lines, rectangles and circles, it solves the problem.

Thanks a lot!

POSTED BY: Ehud Behar
Posted 4 years ago

There is something odd about the coordinates in g1. Add PlotRange -> All to Show to see what I mean. How did you generate g1?

POSTED BY: Rohit Namjoshi

The circle is there, but it is outside the range of the Plot, as you will realize if you replace Circle with Disk. To make the circle visible, add the option PlotRange -> All to Show, otherwise it will honour the PlotRange of the first object. This is a venerable old pitfall of Mathematica.

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