axis

ggplot2 R fix x-axis label at a specific point relative to plot

一世执手 提交于 2021-02-11 04:28:09
问题 Say I have a plot like this: library(ggplot2) dat <- data.frame(x = 1:10, y = 1:10) ggplot(dat, aes(x = x, y = y)) + geom_point() + xlab("Test label") Does ggplot2 allow for fixing the xlab positioning at a specific point? Say I wanted the label to appear centered at the point where x = 7 (rather than the default centering). 回答1: This isn't exactly what you want, but you can adjust the horizontal justification in the theme options. This is relative between 0 and 1, not tied to the data

Plotly: How to remove the empty gap on x-axis

◇◆丶佛笑我妖孽 提交于 2021-02-10 20:33:27
问题 I have done this diagram on plotly And I want to delete the empty gap, to display only the x that have a value, and to hide the x where there isn't any value How am I supposed to do that ? Here is my code : go.Bar(name=i,x=listeDepartement,y=listePPA)) fig = go.Figure(data=bar) fig.update_layout(barmode='stack') fig.write_html('histogram.html',auto_open=True) fig.show() 回答1: The reason why this happens is that plotly interprets your x-axis as dates, and makes a timeline for you. You can avoid

set y-axis in millions [duplicate]

荒凉一梦 提交于 2021-02-05 06:03:53
问题 This question already has answers here : How to format seaborn/matplotlib axis tick labels from number to thousands or Millions? (125,436 to 125.4K) (4 answers) Closed 10 months ago . I have a problem with this plot: [![enter image description here][1]][1] The y-axis is in unit but I need them to be in millions as such: [![enter image description here][2]][2] Do you know a method to achieve this? Thanks in advance. 回答1: You can use a custom FuncFormatter like this: from matplotlib.ticker

axis备忘

佐手、 提交于 2021-01-30 14:53:22
最近接手一个项目,web service用的是axis,简单地做了一个Demo来熟悉。中间碰到了不少麻烦,现在把整个过程记录下来备忘。 开发环境:Eclipse JEE 1.新建Dynamic Web Project。 2.下载axis 1.4,解压,将lib内的文件拷贝到项目的WEB-INF/lib中。 3.下载activation.jar和mail.jar,同样拷贝到项目的WEB-INF/lib中。这两个jar不是运行必需,但是在由deploy.wsdd生成server-config.wsdd过程中要用到。我是从axis2 1.6的lib中直接提取。 4.修改web.xml,添加如下内容。 <servlet> <servlet-name>AxisServlet</servlet-name> <display-name>Apache-Axis Servlet</display-name> <servlet-class> org.apache.axis.transport.http.AxisServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>AxisServlet</servlet-name> <url-pattern>/servlet/AxisServlet</url-pattern> <

How to break axis in a barplot (maybe using plotrix gap.barplot)?

霸气de小男生 提交于 2021-01-29 08:31:37
问题 I found a lot of SO question and answers addressing break and gaps in axis. But most of them are of low quality (in an SO meaning) because of no example code, no picture or to complex codes. This is why I asking. I try to use library(plotrix) . If there is a solution without it and/or another library it would be ok for me, too. This is a normal R-barplot. barplot(c(10,20,500)) To break the axis and add gap I tried this. gap.barplot(c(10,20,500),gap=c(50,400), col=FALSE) The result is not

Matplotlib: how to set only min and max values for tics

亡梦爱人 提交于 2021-01-28 11:02:41
问题 I have pretty similar code to plot: plt.plot(df_tags[df_tags.detailed_tag == tag]['week'], df_tags[df_tags.detailed_tag == tag].tonality) Output: But I want leave only min and max values for x axis this way: plt.plot(df_tags[df_tags.detailed_tag == tag]['week'], df_tags[df_tags.detailed_tag == tag].tonality) plt.xticks([df_tags['week'].min(), df_tags['week'].max()]) print (df_tags['week'].min(), df_tags['week'].max()) With no luck, he puts second week as a last one, but why and how to fix it:

How to write chemical formulas in ggplot [duplicate]

血红的双手。 提交于 2021-01-27 12:00:48
问题 This question already has an answer here : Subscripts and superscripts “-” or “+” with ggplot2 axis labels? (ionic chemical notation) (1 answer) Closed 4 months ago . I need to plot some data and one of the plot has to have the sulphate formula (SO42-) in the labels. I am using this code a=c(1,2,3,4,5) b=c(1,2,3,4,5) dd=data.frame(a,b) G<-ggplot(dd)+ geom_line(x=a, y=b, color="blue")+ labs(x="Depth (m)", y=expression("nss SO"[4]^{2-}"(ppb)")) G And, of course, it doesn't work: either the - is

How to write chemical formulas in ggplot [duplicate]

流过昼夜 提交于 2021-01-27 11:53:49
问题 This question already has an answer here : Subscripts and superscripts “-” or “+” with ggplot2 axis labels? (ionic chemical notation) (1 answer) Closed 4 months ago . I need to plot some data and one of the plot has to have the sulphate formula (SO42-) in the labels. I am using this code a=c(1,2,3,4,5) b=c(1,2,3,4,5) dd=data.frame(a,b) G<-ggplot(dd)+ geom_line(x=a, y=b, color="blue")+ labs(x="Depth (m)", y=expression("nss SO"[4]^{2-}"(ppb)")) G And, of course, it doesn't work: either the - is

Consuming soap service with NTLM Authentication

佐手、 提交于 2021-01-27 09:06:37
问题 I am trying to consume a SOAP service with NTLM authentication by creating a NTLM engine (following instructions on http://hc.apache.org/httpcomponents-client-4.3.x/ntlm.html ) implemented AuthSchemeFactory and finally registered the AuthSchemeFactory to my HTTP Client. When I hit the service using my HTTP Client I get a reponse that "Status code - 415 , Message - The server cannot service the request because the media type is unsupported." Can anybody tell how can I fix this issue of

Consuming soap service with NTLM Authentication

喜欢而已 提交于 2021-01-27 09:06:18
问题 I am trying to consume a SOAP service with NTLM authentication by creating a NTLM engine (following instructions on http://hc.apache.org/httpcomponents-client-4.3.x/ntlm.html ) implemented AuthSchemeFactory and finally registered the AuthSchemeFactory to my HTTP Client. When I hit the service using my HTTP Client I get a reponse that "Status code - 415 , Message - The server cannot service the request because the media type is unsupported." Can anybody tell how can I fix this issue of