cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Shading Graph

MikeArmstrong
5-Regular Member

Shading Graph

Does anyone have a fucntion or neat way to shapean area under a graph?

1 ACCEPTED SOLUTION

Accepted Solutions

I guess you can find a lot of nice ways to shade, color, hatch an area in the "Amazing Images" E-Book.

Byrge Birkeland also had posted a sheet (unfortunately Prime) specifically about shading a region here:

http://communities.ptc.com/docs/DOC-3495

Some other link which might be of interest:

http://communities.ptc.com/message/205924#205924

http://communities.ptc.com/message/158074#158074

http://communities.ptc.com/message/233004#233004

In your case you might first define a piecewise function following your horizontal marker and then the green line and use bars or error bars to shade the area underneath.

View solution in original post

8 REPLIES 8

I guess you can find a lot of nice ways to shade, color, hatch an area in the "Amazing Images" E-Book.

Byrge Birkeland also had posted a sheet (unfortunately Prime) specifically about shading a region here:

http://communities.ptc.com/docs/DOC-3495

Some other link which might be of interest:

http://communities.ptc.com/message/205924#205924

http://communities.ptc.com/message/158074#158074

http://communities.ptc.com/message/233004#233004

In your case you might first define a piecewise function following your horizontal marker and then the green line and use bars or error bars to shade the area underneath.

MikeArmstrong
5-Regular Member
(To:Werner_E)

Thanks Werner,

A few good examples, but no easy way to achieve such a simple task.

Mike Armstrong wrote:

Thanks Werner,

A few good examples, but no easy way to achieve such a simple task.

I agree that shading/filling/hatching an area should be a feature out of the box. In the meantime we have to do it ourself, sort of write-once/use-many.

In your case its even more difficult because you switched dependent and independent axis (so error bars won't work) and you also changed the orientation of the vertical axis (so showing the hatch as a bunch of points doesn't work in the attached sheet).

MikeArmstrong
5-Regular Member
(To:Werner_E)

Werner, your Mathcad capabilities and commitment to this forum never cease to amaze me.

Cheers

Here is a much quicker AreaFill routine. As you can't show a dotted area anyway there is no need for the numerous intermediate points which the other routine creates.

I am also cheating on the boundary values of the plot to be able to show the border.

MikeArmstrong
5-Regular Member
(To:Werner_E)

Nice, very nice indeed. I think will be going in the collection.

Werner Exinger wrote:

I am also cheating on the boundary values of the plot to be able to show the border.

I've had to do that before. Anther example of poor performance, but no moaning tonight

Mike Armstrong wrote:

Nice, very nice indeed. I think will be going in the collection.

Werner Exinger wrote:

I am also cheating on the boundary values of the plot to be able to show the border.

I've had to do that before. Anther example of poor performance, but no moaning tonight

Yes, we can influence the order in which the various plots are made and can put the hatching first so it is overwritten by the graphs. But we cannot influence when the axis or box borders are drawn.

It may make sense for a graph to overwrite the axis, but I guess it seldom makes sense if it overwrites the borders if box style is chosen. An option, something like "axis always on top", would be useful. But when I look at the quality of Prime's plots .... just lets be happy with what we have in Mathcad 15!

MikeArmstrong
5-Regular Member
(To:Werner_E)

Werner Exinger wrote:

It may make sense for a graph to overwrite the axis, but I guess it seldom makes sense if it overwrites the borders if box style is chosen. An option, something like "axis always on top", would be useful. But when I look at the quality of Prime's plots .... just lets be happy with what we have in Mathcad 15!

Yes, I was thinking of suggesting you create an idea, but as you said, Prime's plots need a substantial improvement before additional features are recommended/implemented.

Top Tags