axis-labels

twiny() in matplotlib changes the y-axis scale

风格不统一 提交于 2019-12-21 23:27:12
问题 Plotting some data with matplotlib, it happens that inserting the ax.twiny() module changes the scale of the y axis. Before I use it: And after: I would like to avoid to insert manually the limits in the y-axis. So why does this happen, and how to fix it? 回答1: That's weird. I've tried using the twiny() option and it does not change the scale: import numpy import matplotlib.pylab as plt x = numpy.linspace(0, 4. * numpy.pi, 1000) y = numpy.cos(x) fig = plt.figure() ax1 = fig.add_subplot(1,1,1)

How do I set label for an already plotted line in matplotlib?

混江龙づ霸主 提交于 2019-12-21 07:56:08
问题 In my code I've already executed ax.plot(x, y, 'b.-', ...) and need to be able to set the label for the corresponding line after the fact, to have the same effect as if I'd ax.plot(x, y, 'b.-', label='lbl', ...) Is there a way to do this in Matplotlib? 回答1: If you grab the line2D object when you create it, you can set the label using line.set_label() : line, = ax.plot(x, y, 'b.-', ...) line.set_label('line 1') If you don't, you can find the line2D from the Axes : ax.plot(x, y, 'b.-', ...) ax

WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers

别来无恙 提交于 2019-12-21 07:38:26
问题 I am trying to solve the below issue for last couple of days but still not able to resolve it. I have searched lots of forums but all in vain. * Little bit of history: My code was working well in the devp env but for accessing the production sever I received new URL and three new certificates after successfully including the certificates in new trust store file.I am facing below issue. Please help. 2013-11-25 11:32:30,373 INFO[BuilderUtil] OMException in getSOAPBuilder org.apache.axiom.om

Windows Forms Chart set fixed mixed labels

橙三吉。 提交于 2019-12-19 11:52:03
问题 I would like to fix my labels on my x or y axis, so they are always static. I also want to mix the labelling with numbers and strings like in shown picture. Furthermore the y axis starting with -1, how can I always start with 0? 回答1: Setting CustomLabels is tricky as their FromPositions and ToPositions need to be set correctly or else they won't show at the right positions! See here and here for more examples! Here is one for your question, as I read it: CA.AxisY.Minimum = 0; CA.AxisY.Maximum

Gnuplot image on axis

半世苍凉 提交于 2019-12-19 09:55:12
问题 I'm trying to model a certain progress through some environment. The x axis would represent the location (based on x coordinate) in the environment. In order to make this clear, I'd like an image of the environment (based on a .png) on the x axis (the environment is rather wide and not that high, so it should look good) of my plot, basically as an xtics/x-axis label. Do you have any suggestions on how to approach this? Thanks in advance! 回答1: You can either plot both the image and the data in

Matplotlib: Add strings as custom x-ticks but also keep existing (numeric) tick labels? Alternatives to matplotlib.pyplot.annotate?

二次信任 提交于 2019-12-18 12:52:57
问题 I am trying to produce a graph and I am having some issues annotating it. My graph has a log scale on the x-axis, showing time. What I want to be able to do is keep the existing (but not predictable) numeric tick labels at 100 units, 1000 units, 10000 units, etc but also add custom tick labels to the x-axis that make it clear where more "human readable" time intervals occur---for instance I want to be able to label 'one week', 'one month', '6 months', etc. I can use matplotlib.pyplot.annotate

Multiple y-axis conversion scales

我的梦境 提交于 2019-12-18 12:41:40
问题 Hi I'm trying to create plots which incorporate parallel conversion scales for two sets of units on the y-axis; using the two different styles of: offset ('parasitic') y-axes and overlaid/shared y-axes to replicate the style of the left-hand y-axes in the attached example images. I'd like to find the simplest generic way of producing both of the above example plots, which also allows me to generate the y-axis conversion scales by defining the relationship between the two sets of units as a

ggplot2 x - y axis intersect while keeping axis labels

China☆狼群 提交于 2019-12-18 09:39:20
问题 I posted my original question yesterday which got solved perfectly here Original post I made a few addition to my code library(lubridate) library(ggplot2) library(grid) ### Set up dummy data. dayVec <- seq(ymd('2016-01-01'), ymd('2016-01-10'), by = '1 day') dayCount <- length(dayVec) dayValVec1 <- c(0,-0.22,0.15,0.3,0.4,0.10,0.17,0.22,0.50,0.89) dayValVec2 <- c(0,0.2,-0.17,0.6,0.16,0.41,0.55,0.80,0.90,1.00) dayValVec3 <- dayValVec2 dayDF <- data.frame(Date = rep(dayVec, 3), DataType = factor

How to display all label values in matplotlib?

*爱你&永不变心* 提交于 2019-12-18 03:54:34
问题 I have two lists, when I plot with the following code, the x axis only shows up to 12 (max is 15). May I know how can I show all of the values in x list to the x axis? Thanks in advance. x = [4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3] y = [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160] fig = plt.figure() ax1 = fig.add_subplot(111) ax1.plot(np.arange(len(x)), y, 'o') ax1.set_xticklabels(x) plt.show() If I set minor=True in the set_xticklabels function, it shows me all x=2,4,6,8,..,16...

Matplotlib - hiding specific ticks on x-axis

倾然丶 夕夏残阳落幕 提交于 2019-12-17 23:12:38
问题 I am trying to hide the first and last x-axis tick text of my bar plot, which is '2004' and '2013'. Matplotlib automatically adds these in by default, even though my dataset is for 2005 to 2012, hence I'd prefer not to have 2004 and 2013 in my bar plot. I'm looking for some lines of code to select and hide these ticks. Any ideas? 回答1: Please, tell me if it's not what you want. import sys, os import matplotlib.pyplot as plt path = sys.path[0] sizes = [(12,3,), (4,3,)] x = range(20) for i, size