Jump to content
You must now use your email address to sign in [click for more info] ×

Use python matplotlib plot to save svg format and then import into AD, found that the font is messed up


daxigua

Recommended Posts

24 minutes ago, GarryP said:

Welcome to the forums @daxigua

This is probably related to (or the same as) a known issue.

The linked thread below has a ‘workaround’ which you might like to try (I've not tried it myself and don't know if it is a 'general fix'):

 

Please ask if this bug is fixed in the  version 1.10.6?

 

25 minutes ago, GarryP said:

Welcome to the forums @daxigua

This is probably related to (or the same as) a known issue.

The linked thread below has a ‘workaround’ which you might like to try (I've not tried it myself and don't know if it is a 'general fix'):

 

 

 

Link to comment
Share on other sites

4 minutes ago, GarryP said:

Have you tried it in 1.10.6?

Note: I’m not sure why you repeated your question in a quote in the next thread along with quoting the same thing again. Was that just a mistake?

i install 1.10.6,it has not be fixed........

Link to comment
Share on other sites

I have a feeling that ‘feature problems’, such as this, will never be fixed in V1 since Serif are concentrating on V2 now.

Some of these kinds of ‘feature problem’ might get fixed in V1 because of another (maybe related) fix that needed to be done for stability reasons, but those kind of fixes might be few and far between.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • Staff

Sorry that you have experienced this problem with the Affinity Suite. 

We have now released 2.0.4 on all platforms, and using that build we believe we have made an improvement in that area that should have fixed the crash 

Patrick Connor
Serif Europe Ltd

"There is nothing noble in being superior to your fellow man. True nobility lies in being superior to your previous self."  W. L. Sheldon

 

Link to comment
Share on other sites

  • Staff

There are 2 problems reported in this thread. Sorry I was referring to the crash on startup, not the SVG import problem, which has not been addressed. Sorry for the confusion 

Patrick Connor
Serif Europe Ltd

"There is nothing noble in being superior to your fellow man. True nobility lies in being superior to your previous self."  W. L. Sheldon

 

Link to comment
Share on other sites

  • 3 months later...

Issue may be related to matplotlib.pyplot rcParams.

p.get_figure().savefig("testgetfig.svg", dpi=1200, bbox_inches="tight")

In Affinity 2.1.0:

image.thumb.png.4fa9e05ac87cb8c10fdf9a2f1282b43c.png

plt.rcParams['svg.fonttype'] = 'none'
p.get_figure().savefig("testgetfig.svg", dpi=1200, bbox_inches="tight")

In Affinity 2.1.0:

image.thumb.png.f3c630c3baa25510ac60d886055edf1a.png

 

 

Solution found here: https://stackoverflow.com/questions/34387893/output-matplotlib-figure-to-svg-with-text-as-text-not-curves

 

 

Full code:

import seaborn as sn
import matplotlib.pylab as plt

sn.set(rc={'figure.figsize':(13.3, 7.5)})
plt.style.use('bmh')
p = sn.histplot(dfNumberPerRepAndJarWithZero, x = 'numberOfNemsOnRep', hue = 'GeneID', legend=False, element='bars',kde=True,line_kws ={'alpha':1}, alpha=0.2)

plt.rcParams['svg.fonttype'] = 'none'
p.get_figure().savefig("testgetfig.svg", dpi=1200, bbox_inches="tight")

I am on windows btw

Link to comment
Share on other sites

13 hours ago, Gewoonolaf said:

Issue may be related to matplotlib.pyplot rcParams.

p.get_figure().savefig("testgetfig.svg", dpi=1200, bbox_inches="tight")

In Affinity 2.1.0:

image.thumb.png.4fa9e05ac87cb8c10fdf9a2f1282b43c.png

plt.rcParams['svg.fonttype'] = 'none'
p.get_figure().savefig("testgetfig.svg", dpi=1200, bbox_inches="tight")

In Affinity 2.1.0:

image.thumb.png.f3c630c3baa25510ac60d886055edf1a.png

 

 

Solution found here: https://stackoverflow.com/questions/34387893/output-matplotlib-figure-to-svg-with-text-as-text-not-curves

 

 

Full code:

import seaborn as sn
import matplotlib.pylab as plt

sn.set(rc={'figure.figsize':(13.3, 7.5)})
plt.style.use('bmh')
p = sn.histplot(dfNumberPerRepAndJarWithZero, x = 'numberOfNemsOnRep', hue = 'GeneID', legend=False, element='bars',kde=True,line_kws ={'alpha':1}, alpha=0.2)

plt.rcParams['svg.fonttype'] = 'none'
p.get_figure().savefig("testgetfig.svg", dpi=1200, bbox_inches="tight")

I am on windows btw

THANK YOU!! This slove the problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.