Wireframe: Legend colors with multiple surfaces and transparency
To change colors of lines, you should replace auto.key
with key
and supply list of values for texts and lines.
wireframe(z~x*y,data=SurfaceData,group=type,
col.groups=c("red","green","blue"),
scales = list(arrows=FALSE, col="black",font=10),
xlab = list("Variable X",rot=30),
ylab = list("Variable Y",rot=-30),
zlab = list("Variable Z",rot=90),
zlim = c(0,100),
key=list(text=list(c("A","B","C"),col=c("red","green","blue")),
lines=list(lty=c(1,1,1),col=c("red","green","blue"))),
par.settings = list(axis.line = list(col = "transparent")),
)
To make colors transparent you can use function rgb()
. Here I define new variable mycolors.trans
that contain transparent colors and mycolors
with the same colors but not transparent for legend entries.
mycolors.trans = rgb(c(255,0,0),
c(0,255,0),
c(0,0,255),alpha = 70,maxColorValue = 255)
mycolors = rgb(c(255,0,0),
c(0,255,0),
c(0,0,255),maxColorValue = 255)
wireframe(z~x*y,data=SurfaceData,group=type,
col.groups=mycolors.trans,
scales = list(arrows=FALSE, col="black",font=10),
xlab = list("Variable X",rot=30),
ylab = list("Variable Y",rot=-30),
zlab = list("Variable Z",rot=90),
zlim = c(0,100),
#auto.key=TRUE,
key=list(text=list(c("A","B","C"),col=mycolors),
lines=list(lty=c(1,1,1),col=mycolors)),
par.settings = list(axis.line = list(col = "transparent")),
)
Changing the scales in a wireframe ()
I tried this (following this post):
x <- data.frame(z = as.vector(df.matrix))
x$x <- rep(seq(0, 1, length.out = 10), 10)
x$y <- rep(seq(0, 1, length.out = 10), 10)
wireframe(z ~ x * y, x,
aspect = c(61/87, 0.4),
scales = list(arrows=FALSE,cex=.5,tick.number = 10, z = list(arrows=T)),
# ylim = 1:10,
xlab=expression(phi1),
ylab="Percentile",zlab=" Loss",main="Random Classifier",
light.source = c(10,10,10), drape=T,
col.regions = rainbow(100, s = 1, v = 1, start = 0, end = max(1,100 - 1)/100, alpha = 1),
screen=list(z=-60,x=-60))
Manually set color of points in legend
You can obtain the legend handles and change their colors individually:
ax = plt.gca()
leg = ax.get_legend()
leg.legendHandles[0].set_color('red')
leg.legendHandles[1].set_color('yellow')
Related Topics
How to Get All Possible Combinations of N Number of Data Set
How to Keep Track of Total Transaction Amount Sent from an Account Each Last 6 Month
How to Find The Indices Where There Are N Consecutive Zeroes in a Row
Split Line by Multiple Points Using Sf Package
Prevent Selectinput from Wrapping Text
Generating Dropdown Menu for Plotly Charts
How to Define "Hidden Global Variables" Inside R Packages
How to Plot Multiple Lines in R
Using Recordlinkage to Add a Column with a Number for Each Person
Calculate a 2D Spline Curve in R
How to Create a Rank Variable Under Certain Conditions
How to Get Rstudio to Show Function Arguments and Descriptions for Custom Functions