estebanpw / chromeister

A dotplot generator for large chromosomes
GNU General Public License v3.0
39 stars 4 forks source link

Get plots in pdf or svg formats? #24

Open Sebastardito opened 2 years ago

Sebastardito commented 2 years ago

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!

estebanpw commented 2 years ago

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 commented 2 years ago

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

Thank you!

Sebastardito commented 2 years ago

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 commented 2 years ago

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