axis-labels

Alignment of y axis labels in faced_grid and ggplot?

岁酱吖の 提交于 2019-12-11 11:58:51
问题 By using ggplot and faced_grid functions I'm trying to make a heatmap. I have a categorical y axis, and I want y axis labels to be left aligned. When I use theme(axis.text.y.left = element_text(hjust = 0)) , each panels' labels are aligned independently. Here is the code: #data set.seed(1) gruplar <- NA for(i in 1:20) gruplar[i] <- paste(LETTERS[sample(c(1:20),sample(c(1:20),1),replace = T) ], sep="",collapse = "") gruplar <- cbind(gruplar,anagruplar=rep(1:4,each=5)) tarih <- data.frame(yil=

Change axis of plotly polar plot

不问归期 提交于 2019-12-11 10:37:23
问题 I am playing with Plotly tools using python and I have made a polar plot as seen below using some dummy data: I would like to alter the axis so that the data I have (goes from around 20 to 50) is mapped to the entire 360° of the plot. Is there a way of doing this using a readymade command or do I need to write a function where you set the limits then map those numbers to degrees before changing axis labels. I have been looking through stack exchange but I can only find ways of changing it to

How to properly display sufficient tick markers using plt.savefig?

徘徊边缘 提交于 2019-12-11 10:16:56
问题 After running the code below, the axis tick markers all overlap with each other. At this time, each marker could still have good resolution when zooming popped up by plt.show() . However, the figure saved by plt.savefig('fig.png') would lost its resolution. Can this also be optimised? from matplotlib.ticker import FuncFormatter from matplotlib.pyplot import show import matplotlib.pyplot as plt import numpy as np a=np.random.random((1000,1000)) # create scaled formatters / for Y with Atom

Avoid duplicate dates in d3js axes

a 夏天 提交于 2019-12-11 09:36:21
问题 I have many charts being generated dynamically. For some charts, the dates are near each other, so, axis labels are getting repeated Example: Date format used: d3.time.format("%d-%b-%y") Is there an in-built way to avoid duplication of labels? Or is there a good generic procedure which can avoid such duplication? Note that my charts have zooming feature also and the incoming data is dynamic, so I can't put in hardcoded values of "ticks" or "tickValues". Generating ticks or tickValues

Retrieve axis tick information from a plotly figure

偶尔善良 提交于 2019-12-11 09:29:22
问题 I'm plotting a heatmap using R plotly : set.seed(1) df <- reshape2::melt(matrix(rnorm(100*20),100,20,dimnames = list(paste0("G",1:100),paste0("S",1:20)))) library(plotly) library(dplyr) plot_ly(z=c(df$value),x=df$Var2,y=df$Var1,colors=grDevices::colorRamp(c("darkblue","gray","darkred")),type="heatmap",colorbar=list(title="Scaled Value",len=0.4)) %>% layout(yaxis=list(title=NULL),xaxis=list(tickangle=90,tickvals=10,ticktext="X-Label")) As you can see, plotly is not showing all y-axis ticks. My

Getting greek character in plot axis [duplicate]

别等时光非礼了梦想. 提交于 2019-12-11 08:37:28
问题 This question already has answers here : Adding greek character to axis title (5 answers) Closed 2 years ago . I am making barplots for different metal concentration in various materials, and need the axis to say μg/g . I've searched for how to implement greek characters into different plots, but I don't seem able to actually do so. It looks like I should be able to use ( expression(paste) ) - can anyone help me? This is an extract of my current script: BP.Ag <- ggplot(data=dat, aes(x

Wrong axis labels for ggplot facet grid

只谈情不闲聊 提交于 2019-12-11 08:05:33
问题 I was answering this question that I faced a strange problem; I want to make a bar plot with ggplot2 and have x axis labels as the last character of Group column. Use substring(Group, 3, 3) for this purpose: substring(df$Group, 3, 3) # [1] "1" "2" "3" "1" "2" "1" "2" "3" "4" But when I use it in ggplot like below, it prints 1 instead of 4 at the last tick; ggplot(data=df, aes(x=Group, y=Value)) + geom_bar(stat="identity") + scale_x_discrete(labels = substring(Group, 3, 3), expand=c(0.1,0.1))

Changing the scale of x-axis using scale_x_continuous

我只是一个虾纸丫 提交于 2019-12-11 07:03:48
问题 I am creating a scatter plot using ggplot2. The default gives me an x axis that has every value form 0 to 30. I'd prefer to have it go by 5s or something like that. I have been trying to use scale_x_continuous(), but I get this: Error: Discrete value supplied to continuous scale Here is the code that I am trying to work with: Daily.Average.plot <- ggplot(data = Daily.average, aes(factor(Day), Mass))+ geom_point(aes(color = factor(Temp))) + scale_x_continuous(breaks = seq(0,30,5)) Daily

JFreeChart axis label in Hours

霸气de小男生 提交于 2019-12-11 05:55:32
问题 I have data e.g. (1,3600), (2,4400), ... (33,15000) Where in (1,3000) -> 1 is a number -> 3600 is seconds If put in chart, the axis would show the "second" as number. I have set a code to show axis label in 1 hour interval. // Create an NumberAxis NumberAxis xAxis = new NumberAxis(); xAxis.setTickUnit(new NumberTickUnit(3600)); // Assign it to the chart xyPlot.setDomainAxis(xAxis); So now the axis labels are: 0 ... 3600 ... 7200 ... 10.800 ... How to make the axis labels show in hours? (0 ...

JFreeChart last X-axis label cut off

自古美人都是妖i 提交于 2019-12-11 02:39:31
问题 I've got a nice, pretty JFreeChart-generated Line chart, with one exception - the last value on my X axis is getting truncated, like so: | | |_________|________|__________|_________|_________| 100 Hz 1 kHz 10 kHz 100 kHz 1 MHz 10 MH (Note the z in MHz is cut off). I've looked into the solution here: JFreeChart tick label cut off but because I'm manually specifying the range in a LogAxis it appears from the JavaDoc that setting the margin has no effect. JavaDoc This is the code I'm using to