export_numerical_data_from_the_plot_to_text_file
Hi,
I plotted my data using standard plot() and I want to export these to text file. So, two columns, one for x and the second one for y.
I was thinking about assigning plot to variable and then exporting data as 2D matrix, but the problem is that it is impossible to store plot in variable.
I searched the web and it appears that the only way would be to use one of the Plot Digitizers? Do you know any other way?
thanks
Comments (10)
-
-
- changed status to resolved
not an issue or bug
-
reporter Hi,
Thank you for your answer.
I am familiar with write.table(), but, as I wrote, I don't know how to store plot as a data object, which can be then passed as an argument for this function.
Can you provide an example?
thanks
-
I am not clear what the complication is as you don't provide a reproducible code example.
The plot was produced with some of your data - no? Why can you not write out this same data? What plot function is it specifically (I ask because some do provide output data that can be saved to a new object).
-
To my knowledge, you can't save basic 'plot()' to data files or matrix. I am not familiar with Plot Digitizers, and apparently this is not a bio3d-related issue (so maybe post it on stackoverflow you might get answers more quickly).
To be honest, I don't see the reason you want to convert a plot to a data matrix. If you made the plot by yourself, you should already have the data, which is the input of
plot()
(right?) -
- changed status to open
Still has questions
-
reporter Here is my code:
tree <- community.tree(net21, rescale=TRUE) plot( tree$num.of.comms, tree$modularity)
So, I want to assign plot to a variable(object) and then export this variable as 2D matrix, for example, using write.table(), but as pointed out by Xin-Qiu, I think it is impossible.
Actually, I have just figured out one potential solution. I will export attributes of a tree to .csv and load these one by one in a matrix. I think it should work.
I thought that maybe you know a quicker way of doing this.
-
Instead of attributes, why not just export x-y, e.g.
write.table(cbind(tree$num.of.comms, tree$modularity), file='xxx')
? -
reporter cbind(). This is what I have been looking for. Thank you. You can close the ticket.
-
- changed status to resolved
- Log in to comment
Explore the write.table() family of functions including write.csv() etc. These are base R functions and a google search will help you with further questions about them and related things in the future!