title: prevent plot_ly reordering matrix
body: <p>I recently updated R and Rstudio and naturally now a load of scripts I had written are broken.</p>
  
  <p>Specifically one thing that's causing me issues is the script below. Previously it used to output a heatmap <em>exactly</em> as it appeared in the csv of values I gave it to make the matrix. Now the later versions seem to have changed how they order things. Its now ordering the columns and their labels in ascending numeric order, which is putting them out of order. How can I prevent it rearranging columns, or specify that it treat them as I provided them?</p>
  
  <p>The minor aesthetic issues aren't so much of an issue.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>library(ggplot2)
  library(plotly)
  library(RColorBrewer)
  # Read in data
  library(readr)
  
  
  adjwallace &lt;- read.csv() # see the link for the actual data http://pastebin.com/bBLs8uLt
  
  
  rownames(adjwallace_recluster)[17] &lt;- "Species" #Rename STree
  names(adjwallace_recluster)[17] &lt;- "Species"
  
  
  # Preferences for xaxis
  font.pref &lt;- list(
    size = 20,
    family = "Arial, sans-serif",
    color = "black"
  )
  
  x.axisSettings &lt;- list(
    title = "",
    zeroline = FALSE,
    showline = FALSE,
    showticklabels = TRUE,
    tickfont = font.pref,
    showgrid = TRUE
  )
  
  # Preferences for yaxis
  y.axisSettings &lt;- list(
    title = "",
    zeroline = FALSE,
    showline = FALSE,
    showticklabels = TRUE,
    tickfont = font.pref,
    showgrid = TRUE
  )
  
  margins &lt;- list(
    l = 50,
    r = 10,
    b = 50,
    t = 10,
    pad = 1
  )
  
  # Plot graph as a heatmap
  p &lt;-plot_ly(z = ~data.matrix(adjwallace),
          colors = "YlOrRd",
          name = "Adjusted Wallace Coefficients",
          x = names(adjwallace),
          y = names(adjwallace),
          colorbar = list(title = "Adjusted Wallace &lt;br&gt; Coefficient", titlefont = font.pref),
          type = "heatmap") %&gt;%
          layout(xaxis=x.axisSettings,
           yaxis=y.axisSettings,
           plot_bgcolor='rgba(0,0,0,0)',
           paper_bgcolor='rgba(0,0,0,0)',
           margin = margins
            )
  p
  </code></pre>
  
  <p>And the image this code <em>used</em> to produce (note the x and y axis ordering):
  <a href="https://i.stack.imgur.com/lGT3L.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lGT3L.png" alt="enter image description here"></a></p>
  
  <p>And the script now produces:
  <a href="https://i.stack.imgur.com/pfd3o.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pfd3o.png" alt="enter image description here"></a></p>