0

I have this kind of color palette that I want to use

palette <- colorRampPalette(c("darkblue", "blue", "lightblue1",
                                "green", "yellow", "red", "darkred"))

Illustration how my graphs look at the moment enter image description here

I have used filled.contour() to plot this graph with some modifications.

Here's a part of the code that makes somewhat similar graph

load("workspace.RData")
library(lubridate)

breaks <- "2 hours"
palette <- colorRampPalette(c("darkblue", "blue", "lightblue1",
                              "green", "yellow", "red", "darkred"))
f <- function(x) as.POSIXct(levels(cut(x, breaks)))

filled.contour(x = data$Time,
               y = log10(channels),
               z = df,
               color.palette = palette,
               plot.axes = axis(1, at = f(data$Time),
                                labels = format(f(data$Time), "%H:%M")))

by using data, channels and df from my workspace made with save.image().

Now the function is making the color legend on the right look like that by default. I would like to specify myself that dark blue corresponds to 0 and dark red corresponds to some user defined value for example 20 million.

I want this because if I was to compare the graph of this data with graph of some other data, they would have exactly the same color legend.

Tell me if I need to provide more information or anything.

EDIT:

Provided the data from my workspace as workspace.RData file.

Tsingis
  • 508
  • 3
  • 8
  • 25
  • More information would be useful, see [this link](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). It is difficult for someone to reproduce your example with this little code. – Florian Jul 18 '17 at 10:39
  • Still stuck here. Is there a way I can modify `filled.contour()` function to my liking? – Tsingis Jul 31 '17 at 07:56
  • Extracting your files returned an error for me. To make it more easy for people to actually answer your question, please provide sample data a specified in the link provided earlier, for example using dput(). – Florian Jul 31 '17 at 08:19
  • Current file behind link is my workspace that holds df, data and channels. Is that okay? What kind of error are you getting? – Tsingis Jul 31 '17 at 10:50

1 Answers1

0

levels (and nlevels) parameters seem to do the job just fine... I feel stupid.

Tsingis
  • 508
  • 3
  • 8
  • 25