Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DOC] New figure for the gallery (showcase section)#7072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 9 commits intomatplotlib:masterfromrougier:showcase
Sep 11, 2016

Conversation

rougier
Copy link
Member

@rougierrougier commentedSep 9, 2016
edited
Loading

This is a figure for the showcase section. It shows the different elements composing a figure.

anatomy

@rougierrougier changed the titleNew figure for the gallery (showcase section)[DOC] New figure for the gallery (showcase section)Sep 9, 2016
Y2 = 1+np.cos(1+X/0.75)/2
Y3 = np.random.uniform(Y1, Y2, len(X))

plt.figure(figsize=(8, 8), facecolor="w")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The two lines can be replaced by the following (which I find slightly more elegant):

fig, ax = plt.subplots(figsize=(8, 8), facecolor="w", subplot_kw={"aspect": 1})

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm not too fond of this syntax, I find it more confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think both ways are fine, But in the current I would replace the "matlab like" shorthand syntax

ax = plt.subplot(111, aspect=1)

with the more explicit version

ax = plt.subplot(1, 1, 1, aspect=1)

http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.subplot

@jenshnielsen
Copy link
Member

Really cool and useful plot. We should perhaps find a way to integrate it into the prose docs too

@tacaswell
Copy link
Member

Should replace the image athttp://matplotlib.org/faq/usage_faq.html#parts-of-a-figure


# Axis
circle(0.5, 0.5)
text(0.5, 0.3, "Axis")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this should be 'Axes`

@tacaswelltacaswell added this to the2.0 (style change major release) milestoneSep 9, 2016
@rougier
Copy link
MemberAuthor

I've added a commit to change the figure in the FAQ. I canot yet compile the documentation to check the result though.

@tacaswell
Copy link
Member

@rougier What is still blocking you on the docs?

@rougier
Copy link
MemberAuthor

Oh only local problems, mostly because matplotlib is already installed from what I've understood.

@NelleV
Copy link
Member

I can help with that if you come to see me.

On 9 September 2016 at 05:57, Nicolas P. Rougiernotifications@github.com
wrote:

I've added a commit to change the figure in the FAQ. I canot yet compile
the documentation to check the result though.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#7072 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AALR3kIUyWVGagbhEXSnJegIE62UVWAEks5qoVe0gaJpZM4J46gH
.

edgecolor='none', facecolor='black', alpha=.025)
plt.axes().add_artist(circle)
circle = Circle(center, radius, clip_on=False, zorder=30,
edgecolor='black', facecolor='none', linewidth=1.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think all of this could be simplified to oneCircle call with help ofPathEffects.withStrokehttp://matplotlib.org/examples/pylab_examples/patheffect_demo.html

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not totally because of the transparency of the background (while the white outline is opaque)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Try this, very close to what you have

defcircle(x,y,radius=0.15):frommatplotlib.patheffectsimportwithStrokecircle=Circle((x,y),radius,clip_on=False,zorder=10,linewidth=1,edgecolor='black',facecolor=(0,0,0,.0125),path_effects=[withStroke(linewidth=5,foreground='w')])plt.axes().add_artist(circle)

@efiring
Copy link
Member

This might further the misconception that markers must be made usingscatter rather thenplot. Would it be too cluttered it you were to illustrate the scatter plot using markers with varying size, and possibly color, and then show uniform markers in one of the two lines?

@QuLogic
Copy link
Member

Have you tried building this figure with the2.x branch? There are many small tweaks that may have been necessary before, but likely aren't now, e.g., there's no reason to turn off the frame legend now.

Also, theFigure andAxes annotations are a bit vague.

@Kojoley
Copy link
Member

@rougier I have openedrougier#2 with circle creation simplification and OO modification.

@rougier
Copy link
MemberAuthor

@Kojoley Thanks, didn't know color arguments accept RGBA format. Your code much simpler now.

@rougier
Copy link
MemberAuthor

@efiring What would be the use case for scatter plot then ? It's seem reasonable to use scatter to plot a bunch of markers, no?

@NelleV
Copy link
Member

@efiring@rougier We've had this problem with plot vs scatter since a very very long time. I think that the fact we are having still this problem shows an interface and naming problem (ie, a bug). How complicated it would it be to fix scatter so that it behaves like plot when no size or color argument are provided?

@NelleV
Copy link
Member

@rougier the scatter plots is "supposed" to be used when displaying markers of different size or color (or both). It recomputes a bunch of elements for each marker you draw, while plot doesn't. It renders scatter plot quite inefficient both time wise and memory wise when used on large datasets.
There is absolutely no way a user would know this unless he/she had a look at the implementation.

@efiring
Copy link
Member

@NelleV Rather than modify scatter to return completely different artists (Line2D versus PatchCollection) depending on its arguments, I think the problem is addressed better via documentation and examples. Using scatter when plot would suffice is inefficient for very large data sets, as you note, but otherwise not harmful.

@efiring
Copy link
Member

@NelleV Note also that the argument lists for plot and scatter are very different, corresponding to the major differences between the artists they return.

rougier added a commit to rougier/figure-anatomy that referenced this pull requestSep 10, 2016
@rougier
Copy link
MemberAuthor

Is it ready to merge or does it need more modifications ?

@tacaswelltacaswell merged commit440adff intomatplotlib:masterSep 11, 2016
tacaswell added a commit that referenced this pull requestSep 11, 2016
DOC: Replace anatomy of a plot figure
@tacaswell
Copy link
Member

backported to v2.x asca51e8d

@QuLogic
Copy link
Member

So we're keeping this with the ticks the wrong way?

@QuLogic
Copy link
Member

Also, inv2.x, the markers are invisible.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
v2.0.0
Development

Successfully merging this pull request may close these issues.

8 participants
@rougier@jenshnielsen@tacaswell@NelleV@efiring@QuLogic@Kojoley@mdboom

[8]ページ先頭

©2009-2025 Movatter.jp