Using Julia-lang, how can a scatterplot of two vectors be plotted with pyplots (or GR) to label each point with a specific string? Eg. each paired (x,y) takes on the index value they both share? Example from MATLAB: image example
Do you mean with GR or PyPlot themselves, or through Plots.jl? I know Plots.jl best - with that you'd do scatter(x,y, series_annotations = text.(1:length(x), :bottom)) .
Unfortunately it currently plots very close to the points - :bottom means that the bottom of the text touches the point.
Related
I have a problem plotting heatmap with log colorbar with Gnuplot.jl. I currently use the following code
using Gnuplot
#gp P_save "w image notit" "set logscale cb"
which generates the following figure
The problem is I need to replace y axis with its real value (using another vector called Depth) rather than using index from 0 to 150. And Depth has Non-uniform grid.
And do the same for x axis too.
I have looked at these two posts enter link description here and enter link description here. But in my case I don't have external files and data are in variable arrays or vectors.
P_save is 150×731 Matrix{Float64}, Depth is a 150-element Vector.
I am very new to both Gnuplot.jl and gnuplot.
Thank you so much!
I have troubles creating a ternary plot. I tried both the functions in the ggtern and Plotly package. I have a set of (x,y) coordinates, all between 0d and 1. When I just do a regular geom_point() plot, I can nicely see the results in Cartesian space.
Then I have tried the ggtern() function after converting my (x,y) coordinates to ternary space but I get a very different result and the points don't show up with a similar distribution as in Cartesian space.
Since I want to make a ternary contour plot, it seems quite necessary I get a similar distribution of points as in Cartesian space.
I tried the following conversion, with different values for 'direction' option:
Ternary_Coords<-as.data.frame(t(XYToTernary(VarX,VarY),direction=2)))
But my points never look the same as on the cartesian plot.
What could the problem be?
Many thanks in advance!
is it possible to "mirror" the y axis with R plotly ? I would like to do something similar to this, but with a mirrored y-axis, in order to plot 2 by 2 some data, one replicate one the regular yaxis, and the other on the mirrored axis (that would prevent me to convert a half of my data to negative values).
Also, if possible, I want the bars to be on the same place (one right under the other), not on two distinct sides like showed in the link.
Thanks in advance.
Sorry if this question has already been answered but I can't find a solution.
I have a data frame which is imported from a .csv file. It has four columns. I want to plot a 3d scatter plot of the first two columns against the last column using Plotly.
The problem is that for some reason, the scatter plot does not automatically resize its axes to fit the plot space. So in this case I end up with a tall thin plot. The weird thing is that if I do an example with some random numbers, I don't get this problem.
Can anyone help me to get my scatter plot to fit to the window?
My data can be found at https://www.dropbox.com/s/ojwrezjker33x2b/Data.csv?dl=0
Basically I want to do:
library(plotly)
X<-read.csv("Data.csv")
plot_ly(x=X[,1],y=X[,2],z=X[,4],type='scatter3d',mode='markers')
And this results in a tall and thin scatter plot (sorry can't post an image cos I am new to the site).
I would like this to be a well-proportioned scatter plot that fits the window.
Thanks for any help.
The default setting for aspectmode is 'auto' and Plotly will try to keep the relative axis lenghts equal.
If you set aspectmode='cube' you should get a plot with identical absolute axes lengths.
plot_ly(x=X[,1],y=X[,2],z=X[,4],type='scatter3d',mode='markers') %>%
layout(scene=list(aspectmode='cube'))
I am attempting to project data onto a plot in R and see the correlation between the points. I have added a line to let the reader see the connection between these points. I am however stumped when it comes to inputting arrows to show the direction of the line. Rddproj was just an arbitrary name given to the data. Three sets of x and y coordinates are plotted x=c(-0.7159425, -0.8129311, -0.7392371); y=0.7743088, 0.7732762, 0.7490996) Here is the example below.
x<-rddproj[1:3,1]; y<-rddproj[1:3,2]
plot(x,y)
My concern is that the second group of coordinates is the greatest negative point on the x-axis. In drawing a line with arrows, the arrow will most likely point towards this point, when it should be forming a V with that point in the middle. Is it possible to plot an arrow to reflect the placement of points in a group and not just the most positive point to the most negative point or vice versa?
The arrows function ( a modified segments function) is used for this purpose (to the extent that I understand the question) in base R:
# fixed your assignment code.
plot(NA, xlim=range(x), ylim=range(y) )
arrows(head(x,-1),head(y,-1),tail(x,-1), tail(y,-1), angle=30)
An alternative reading of your question would have the glaringly obvious solution : plot(x,y) which I hope is not what you were asking since that should have been satisfactory.