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

Add example code for current logo#13169

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
jklymak merged 1 commit intomatplotlib:masterfromtimhoffm:logo
May 11, 2019
Merged

Conversation

@timhoffm
Copy link
Member

@timhoffmtimhoffm commentedJan 12, 2019
edited
Loading

PR Summary

This adds code for creating a current logo (logo2.png). For the time being I've simply added the code to the existing logo example. We should decide later on the existing example can be removed (because it's an old version) or if we want to keep both.

This will still need some optimizations.

Open issues:

  • I would like the circle to go to the edge of the image. However, there's still a (constant?) margin. It's more obvious for the smaller sizes.
  • Would be good to have an option to generate the full matplotlib logo including the text. Still not sure, what the font is. From what I've checked, it looks a lot like Calibri Bold, but it's a bit slanted. However, it's not Calibri Bold Italic because that one uses another type of "a". Does anybody know more on the font?
  • The bars inlogo2.png are not exactly in the same places as in this example. Not sure if that really matters.

For review:

Rendered example from CI

@ImportanceOfBeingErnest
Copy link
Member

Concerning the last point, I think the current logo (the one the matplotlib.org page) looks much nicer. This is mainly due to the orange bars not sitting tight against the 90°, -45° lines, but rather in between or on top. For the example it probably doesn't matter, but if someone is planning to use it for some official thing, I think it might be worth the effort to change it.

Concerning the font, it seems to be Calibri, but modified with a transform (seehere)

transform="matrix(1,0,-0.0743587,1,0,0)"

Possibly this can be applied to aTextPath via anAffine2D transform in matplotlib.

@timhoffm
Copy link
MemberAuthor

Concerning the last point, I think the current logo (the one the matplotlib.org page) looks much nicer. This is mainly due to the orange bars not sitting tight against the 90°, -45° lines, but rather in between or on top.

Turns out, the example code got broken because the alignment of barplots changed from 'edge' to 'center' in v2.0. Puttingalign='edge'restores the bar positions as seen in the logo image. 😃

IMHO the logo itself looks quite good now. Didn't have time to look into the text so far.

plt.savefig('logo_xsmall.png')

##############################################################################
#
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can just remove the old stuff? People can always look at our old documentation to find it.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That's the plan. I'll clean up the PR once I've found time to get the text in.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@QuLogic
Copy link
Member

I don't have Calibri, so I used Carlito instead, with:

@@ -21,10 +22,17 @@ def make_logo(pixels, lw_bars, lw_grid, lw_border, rgrid):      with plt.rc_context({'axes.edgecolor': mpl_blue,                          'axes.linewidth': lw_border}):-        fig = plt.figure(figsize=(pixels / dpi, pixels / dpi), dpi=dpi)+        fig = plt.figure(figsize=(5 * pixels / dpi, pixels / dpi), dpi=dpi)         fig.patch.set_alpha(0)-        ax = fig.add_axes((0.03, 0.03, .94, .94), projection='polar')+        fig.text(0.5, 0.5, 'matplotlib', fontsize=pixels * 0.8,+                 color=mpl_blue, ha='center', va='center',+                 fontfamily='Carlito', fontstyle='italic', fontweight='bold',+                 zorder=-10+        )++        ax = fig.add_axes((0.54, 0.1, .17, 0.8),+                          projection='polar')         ax.set_axisbelow(True)          N = 7

and you get something pretty close:
image

Now, Carlito is not the same as Calibri, which has rounder edges and a double-stack 'a', but it's supposed to be metrically equivalent, so you should be able to stick Calibri in and not have to fiddle with the numbers.

@anntzer
Copy link
Contributor

Looking at the first version of the svg (both the version with text as text and the version with text as paths can be seen athttps://github.com/matplotlib/matplotlib/pull/5758/files) it looks like this is calibri bold with "manual" slanting (transform="matrix(1,0,-0.0743587,1,0,0)").

It's too bad Matplotlib's logo is using a non-free font, but heh.

@timhoffm
Copy link
MemberAuthor

Updated the plot with the option to add the "matplotlib" text.

@anntzer Thanks for the hint on the transform. I'm trying to do this with the matplotlib Transforms by

fig.text(..., transform=Affine2D.from_values(1, 0, -0.0743587, 1, 0, 0))

However, the text is not slanted but is shifted.

Without transform:
image

With transfrom:
image

I suspect I'm overriding some default tranform for the fig text here and I should somehow chain these transforms. Unfortunately, I don't understand the transforms well enough :sad:. Can you give me a hint what to do?

@timhoffmtimhoffmforce-pushed thelogo branch 2 times, most recently from96c8a57 to7379c40CompareMarch 31, 2019 10:46
@ImportanceOfBeingErnest
Copy link
Member

ImportanceOfBeingErnest commentedMar 31, 2019
edited
Loading

Thetransform of atext applies to the anchor point (x,y) of the text. It cannot be used to transform the letters of the text. Inmy first comment above I suggested to use aTextPath for the transform.

Now it seems the svg coordinate systems is reflected compared to the one used by matplotlib, so the slanting will need a positive instead of a negative angle. This angle seems to be 4.25° (since tan(4.25)=0.0743128).

So in total,

import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.textpath import TextPathfrom matplotlib.font_manager import FontPropertiesfrom matplotlib.patches import PathPatchimport matplotlib.transforms as mtransfig, ax = plt.subplots()fig.patch.set_alpha(0)pixels = 300fp = FontProperties(family='Calibri', weight = 'bold')path = TextPath((0,0), "matplotlib", size=pixels * 0.8, prop=fp)angle = 4.25 #degrees# eithertrans = mtrans.Affine2D().from_values(1, 0, np.tan(np.deg2rad(angle)), 1, 0, 0)# ortrans = mtrans.Affine2D().skew_deg(angle, 0)patch = PathPatch(path, transform = trans + ax.transData)ax.add_patch(patch)ax.set_aspect("equal")ax.autoscale()plt.show()

image

@timhoffm
Copy link
MemberAuthor

Note: I've removed all the code for drawing the old logo. I don't think anybody will be interested in this. If so, they can still go back in history in the repo.

This example generates the currentmatplotliblogo.
Thanks to Tony Yu <tsyu80@gmail.com> for the logo design
Thanks to Tony Yu <tsyu80@gmail.com> for theoriginallogo design.
Copy link
MemberAuthor

@timhoffmtimhoffmApr 30, 2019
edited
Loading

Choose a reason for hiding this comment

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

Does anybody know who has created the current logo?

Copy link
Member

Choose a reason for hiding this comment

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

The log for the file goes back to4d11bf4, so JDH? There's not code there either, so hard to say. Possibly it came from some separate website repo...

Copy link
Member

Choose a reason for hiding this comment

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

Nope, sorry, that's the old logo. The new one was added in#5653 and was apparently the logo shipped as stickers for a year before that. I don't know if it was@mdboom who designed it or someone else.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I have moved the original logo credit to the credits page. It's better to collect all credits there and not scatter them throughout the documentation. If anybody wants to add credit for the current logo, please do there.

@timhoffmtimhoffmforce-pushed thelogo branch 2 times, most recently from0d9af7e to199fd92CompareMay 1, 2019 13:46
@timhoffm
Copy link
MemberAuthor

timhoffm commentedMay 1, 2019
edited
Loading

Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks a lot for putting this together.

@WeatherGod
Copy link
Member

WeatherGod commentedMay 9, 2019 via email

Pretty sure it was Thomas's wife who did the logo re-design, or was thatthe website facelift?
On Thu, May 9, 2019 at 11:47 AM David Stansby ***@***.***> wrote: ***@***.**** approved this pull request. Looks good to me, thanks a lot for putting this together. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#13169 (review)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AACHF6C3JHEHS2GP5WJS6ETPURBSLANCNFSM4GPTJYIA> .

@timhoffm
Copy link
MemberAuthor

I have moved the original logo credit to the credits page. It's better to collect all credits there and not scatter them throughout the documentation. If anybody wants to add credit for the current logo, please do there.

@jklymak
Copy link
Member

Sorry if I missed discussion above, but the render you link did not find the correct font:Original font not found. The logo text will not be in the correct font.

@anntzer
Copy link
Contributor

I think it would be nice to keep the old logo around, e.g. in the history.rst page (which already has an even older logo as well).

@timhoffm
Copy link
MemberAuthor

@jklymak That is correct. The original font would be Calibri, but the font is not publically available in linux and I don't think we can add it to the repo due to copyright.

@jklymak
Copy link
Member

But this isn’t even a bold font. You can’t use a font that looks ok?

@timhoffm
Copy link
MemberAuthor

We can use Carlito see here:#13169 (comment)

Probably need to install this package to the doc building server:
https://www.ubuntuupdates.org/package/core/disco/universe/base/fonts-crosextra-carlito

@timhoffm
Copy link
MemberAuthor

timhoffm commentedMay 11, 2019
edited
Loading

Now using Carlito in CI:Rendered example from CI

Thehistory page (CI) now contains the previous logo from this example.

@jklymakjklymak merged commit8f62234 intomatplotlib:masterMay 11, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestMay 11, 2019
@timhoffmtimhoffm deleted the logo branchMay 11, 2019 15:19
dstansby added a commit that referenced this pull requestMay 11, 2019
…169-on-v3.1.xBackport PR#13169 on branch v3.1.x (Add example code for current logo)
@tacaswelltacaswell modified the milestones:v3.1.1,v3.1.0May 18, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@NelleVNelleVNelleV left review comments

@QuLogicQuLogicQuLogic left review comments

@anntzeranntzeranntzer left review comments

@jklymakjklymakjklymak approved these changes

@dstansbydstansbydstansby approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

v3.1.0

Development

Successfully merging this pull request may close these issues.

9 participants

@timhoffm@ImportanceOfBeingErnest@QuLogic@anntzer@WeatherGod@jklymak@NelleV@dstansby@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp