Giter Site home page Giter Site logo

Problem with Font awesome on VsCode about pywaffle HOT 8 OPEN

gyli avatar gyli commented on June 19, 2024 1
Problem with Font awesome on VsCode

from pywaffle.

Comments (8)

jhncls avatar jhncls commented on June 19, 2024 2

I can reproduce the problem on my machine with matplotlib 3.5.3, while with matplotlib 3.5.2 it works well.
Python 3.7.4, Windows 10 with PyCharm.

The issue can be simplified to the following, where the icon is rendered much too large.

from matplotlib import pyplot as plt
import matplotlib.font_manager as fm

prop = fm.FontProperties(size=20)
prop.set_file('C:\\Projects\\test\\venv\\lib\\site-packages\\fontawesomefree\\static\\fontawesomefree\\otfs\\Font Awesome 6 Free-Solid-900.otf')
plt.text(0.5, 0.5, 'a', fontproperties=prop)
plt.show()

image

Setting the fontsize to something small doesn't really help; it renders some garbled lines. Here is what happens with size 1:
image

from pywaffle.

Langhammer avatar Langhammer commented on June 19, 2024 1

I have the same problem, I had installed
matplotlib 3.6.3
fontawesomefree 6.3.0
pywaffle 1.1.0

but I tried it also with fontawesomefree 6.2.1. For changing the version, I followed the instructions on the website.

I executed this in a Jupyter Notebook in VSCode with python 3.10.0.
Plotting characters works fine, the problem only occurs when plotting icons.

from pywaffle.

gyli avatar gyli commented on June 19, 2024

I am not able to reproduce this issue, and I got following result

Screenshot 2023-01-25 at 10 06 10 PM

The libraries I am testing:
fontawesomefree 6.2.1
matplotlib 3.6.3
pywaffle 1.1.0

Could you share more details of the library versions, and how it was executed?

from pywaffle.

gyli avatar gyli commented on June 19, 2024

Hi @MalikQasimAli and @Langhammer , could you share more info other than versions of matplotlib, fontawesomefree and pywaffle, like VS code version and platform?

I am still not able to reproduce this issue with versions same as Langhammer mentioned above. Python 3.10.0, matplotlib 3.6.3, fontawesomefree 6.3.0, and pywaffle 1.1.0 in VS Code notebook.
Screenshot 2023-02-20 at 9 14 34 PM

from pywaffle.

Rustic-Citrus avatar Rustic-Citrus commented on June 19, 2024

I am having exactly the same problem. I asked a question on StackOverflow and another user redirected me here.

Below is some information about the modules I am using:

Name: pywaffle
Version: 1.1.0
Summary: PyWaffle is an open source, MIT-licensed Python package for plotting waffle charts.
Home-page: https://github.com/gyli/PyWaffle
Author: Guangyang Li
Author-email: [email protected]
License: MIT
Location: C:\Users\harry\AppData\Roaming\Python\Python311\site-packages
Requires: fontawesomefree, matplotlib
Required-by:
---
Name: fontawesomefree
Version: 6.1.1
Summary: Font Awesome Free
Home-page: https://github.com/FortAwesome/Font-Awesome
Author: Font Awesome
Author-email: [email protected]
License: UNKNOWN
Location: C:\Users\harry\AppData\Roaming\Python\Python311\site-packages
Requires:
Required-by: pywaffle
---
Name: matplotlib
Version: 3.7.0
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: [email protected]
License: PSF
Location: C:\Users\harry\AppData\Roaming\Python\Python311\site-packages
Requires: contourpy, cycler, fonttools, kiwisolver, numpy, packaging, pillow, pyparsing, python-dateutil
Required-by: ipympl, pywaffle

I attempted to uninstall the matplotlib-3.7.0 and reinstall matplotlib-3.5.2 to see if it would work for me as well, but it raised a legacy-install-failure (see the log below for details).

ErrorLog_2023-02-28.txt

So, does this mean that there is a compatibility issue between versions of matplotlib after 3.5.2 and pywaffle-1.1.0?

EDIT: For clarification, it does not make a difference whether I run a Python script through PowerShell, run a JupyterNotebook in the browser or a JupyterNotebook through Visual Studio Code; I get the same problem.

from pywaffle.

Langhammer avatar Langhammer commented on June 19, 2024

I run a jupyter notebook in vscode 1.75.1. Interestingly, it works on binder with the same requirements.txt.
this time I am using matplotlib 3.7.0.
A small example:

from matplotlib import pyplot as plt
from pywaffle import Waffle

fig = plt.figure(
    FigureClass=Waffle,
    rows=1,
    icons='person',
    font_size=3,
    values={'a':1, 'b':2, 'c':3}
)

grafik

from pywaffle.

gyli avatar gyli commented on June 19, 2024

Based on @jhncls's finding, we can basically narrow root cause down to rendering font awesome in matplotlib. I also guess that it only happens on Windows, since that is all the cases reported above, and I am not able to reproduce it with 2 mac that I own.

His testing codes

from matplotlib import pyplot as plt
import matplotlib.font_manager as fm

prop = fm.FontProperties(size=20)
prop.set_file('C:\\Projects\\test\\venv\\lib\\site-packages\\fontawesomefree\\static\\fontawesomefree\\otfs\\Font Awesome 6 Free-Solid-900.otf')
plt.text(0.5, 0.5, 'a', fontproperties=prop)
plt.show()

outputs the correct result on my end. So could you submit this issue on matplotlib repo?

cc @Langhammer @MalikQasimAli @Rustic-Citrus

from pywaffle.

Langhammer avatar Langhammer commented on June 19, 2024

@gyli Yes, it seems to be a problem with matplotlib on windows.

from pywaffle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.