Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Contour plot: default x and y axis

It feels ridiculous, but from the different examples available on Plot.ly website and ones found on Youtube and such, I cannot identify how the default settings for the contour plots work. The pdf manual of Plot.ly (from CRAN) does not explain any of the plotting options either.

I have created a matrix (with 80 columns and 1340 rows), with the header of the columns for the y-axis and the header of the rows for the x-axis. I do obtain a contour plot but with the labels displaying the number of rows and columns, not the values of the headers. The headers are numerical set as headers using rownames and colnames commands.

From the “Volcano.cvs”, it looks like the default should be using headers as labels in a matrix. So why it does not work in my case?

My code is a tad long, as I need to import and treat data before plotting it. Concentrated version: import text files as a list, use lapply to make a data.frame with each set one after the other, then I use left-join to use the same variable in one column (my X-values) and each following columns (for each text file) are my Z-values. Finally, I create my Y-values and use bind-rows to append the Y-values, and set X and Y as headers using rownames and colnames commands.

Just in case: I realized that the “X-axis” are the headers of the columns while the “Y-axis” are the headers of the rows, a tad counter-intuitive but there.