Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get plots in pdf or svg formats? #24

Open
Sebastardito opened this issue Jan 31, 2022 · 4 comments
Open

Get plots in pdf or svg formats? #24

Sebastardito opened this issue Jan 31, 2022 · 4 comments

Comments

@Sebastardito
Copy link

Hello Esteban,

I'm experiencing hard times trying to modify the R Script to get vectorized plots to post-edit them. I'm getting over-dimensioned plots and I have no idea about what is going on despite I think is the same code after change the format. Could you help me?

Thank you in advance!

@Sebastardito Sebastardito changed the title Get the plot in pdf or svg formats? Get plots in pdf or svg formats? Jan 31, 2022
@estebanpw
Copy link
Owner

Hello!

Actually this came out in another issue. A possible workaround is described here

Using that python script will allow you convert the raw dotplot matrix into an svg.

Let me know if that helps,
Esteban

@Sebastardito
Copy link
Author

Great! I'll try it. I'll let you know how that works.

Thank you!

@Sebastardito
Copy link
Author

Thanks Esteban! The script works!

After removing the first line from the raw matrix file, the matrix was processed with this python script...

import matplotlib.pyplot as plt
import numpy as np
import matplotlib
matplotlib.use('Agg')

fig = plt.figure(figsize=(16, 16))
matrix = np.loadtxt('~/outputs/test.raw.txt')
plt.imshow(matrix, cmap='Greys', interpolation='nearest')
plt.gca().invert_yaxis() #I add this to invert the y-axis to have a similar plot that you get in an png output
plt.savefig("/outputs/test.svg")

Maybe, I will try to develop an improved script based on this to share it later here.

Thank you for your help!

@estebanpw
Copy link
Owner

estebanpw commented Feb 5, 2022

Thanks Esteban! The script works!

I am happy that it helped then!

The plt.gca().invert_yaxis() #I add this to invert the y-axis to have a similar plot that you get in an png output is a super nice addition. Thanks for reporting back!

Maybe, I will try to develop an improved script based on this to share it later here.

If you are interested, you could fork the project and make a pull request including the new updated script, that would be very cool. Otherwise, I will add the current one when I have some spare time :)

Bests,
Esteban

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants