[DOC] New figure for the gallery (showcase section)#7072
[DOC] New figure for the gallery (showcase section)#7072tacaswell merged 9 commits intomatplotlib:masterfrom
Conversation
examples/showcase/anatomy.py
Outdated
| Y2 = 1+np.cos(1+X/0.75)/2 | ||
| Y3 = np.random.uniform(Y1, Y2, len(X)) | ||
|
|
||
| plt.figure(figsize=(8, 8), facecolor="w") |
There was a problem hiding this comment.
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})
There was a problem hiding this comment.
I'm not too fond of this syntax, I find it more confusing.
There was a problem hiding this comment.
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
|
Really cool and useful plot. We should perhaps find a way to integrate it into the prose docs too |
|
Should replace the image at http://matplotlib.org/faq/usage_faq.html#parts-of-a-figure |
examples/showcase/anatomy.py
Outdated
|
|
||
| # Axis | ||
| circle(0.5, 0.5) | ||
| text(0.5, 0.3, "Axis") |
|
I've added a commit to change the figure in the FAQ. I canot yet compile the documentation to check the result though. |
|
@rougier What is still blocking you on the docs? |
|
Oh only local problems, mostly because matplotlib is already installed from what I've understood. |
|
I can help with that if you come to see me. On 9 September 2016 at 05:57, Nicolas P. Rougier notifications@github.com
|
examples/showcase/anatomy.py
Outdated
| 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) |
There was a problem hiding this comment.
I think all of this could be simplified to one Circle call with help of PathEffects.withStroke http://matplotlib.org/examples/pylab_examples/patheffect_demo.html
There was a problem hiding this comment.
Not totally because of the transparency of the background (while the white outline is opaque)
There was a problem hiding this comment.
Try this, very close to what you have
def circle(x, y, radius=0.15):
from matplotlib.patheffects import withStroke
circle = 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)|
This might further the misconception that markers must be made using |
|
Have you tried building this figure with the Also, the |
|
@Kojoley Thanks, didn't know color arguments accept RGBA format. Your code much simpler now. |
|
@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? |
Suggestions for matplotlib#7072
|
@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? |
|
@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. |
|
@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. |
|
@NelleV Note also that the argument lists for plot and scatter are very different, corresponding to the major differences between the artists they return. |
|
Is it ready to merge or does it need more modifications ? |
DOC: Replace anatomy of a plot figure
|
backported to v2.x as ca51e8d |
|
So we're keeping this with the ticks the wrong way? |
|
Also, in |
This is a figure for the showcase section. It shows the different elements composing a figure.