Convert your x-axis data from text to datetime.datetime
, use datetime.strptime
:
>>> from datetime import datetime >>> datetime.strptime("2012-may-31 19:00", "%Y-%b-%d %H:%M") datetime.datetime(2012, 5, 31, 19, 0)
This is an example of how to plot data once you have an array of datetimes:
import matplotlib.pyplot as plt import datetime import numpy as np x = np.array([datetime.datetime(2013, 9, 28, i, 0) for i in range(24)]) y = np.random.randint(100, size=x.shape) plt.plot(x,y) plt.show()

Related Posts:
- How to plot ROC curve in Python
- What is the difference between importing matplotlib and matplotlib.pyplot?
- python – how to get the data from an plt.imshow()?
- How do you change the size of figures drawn with Matplotlib?
- matplotlib savefig() plots different from show()
- How do I draw a grid onto a plot in Python?
- Save plot to image file instead of displaying it using Matplotlib
- How do you change the size of figures drawn with Matplotlib?
- Matplotlib automatic legend outside plot
- Matplotlib automatic legend outside plot
- Changing the “tick frequency” on x or y axis in matplotlib?
- How to add title to subplots in Matplotlib
- How can I convert an RGB image into grayscale in Python?
- Create own colormap using matplotlib and plot color scale
- How to make a 3D scatter plot in matplotlib
- Modify the legend of pandas bar plot
- Changing the “tick frequency” on x or y axis in matplotlib
- When to use cla(), clf() or close() for clearing a plot in matplotlib?
- Remove xticks in a matplotlib plot?
- Display an image with Python
- Scatter plot colorbar – Matplotlib
- Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python
- How to plot a 2d matrix in python with colorbar? (like imagesc in Matlab)
- How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?
- ImportError: DLL load failed: The specified module could not be found
- ImportError: DLL load failed: The specified module could not be found
- Purpose of “%matplotlib inline”
- TypeError: only size-1 arrays can be converted to Python scalars (matplotlib)
- Showing an image with pylab.imshow()
- ImportError: No module named matplotlib.pyplot
- ImportError: No module named matplotlib.pyplot
- What is the necessity of plt.figure() in matplotlib?
- Is “from matplotlib import pyplot as plt” == “import matplotlib.pyplot as plt”?
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- ImportError: No module named matplotlib.pyplot
- Plotting a 2D heatmap with Matplotlib
- ImportError: ‘No module named plotly.plotly’ in LinuxMint17.3
- How to plot a histogram using Matplotlib in Python with a list of data?
- Plot logarithmic axes with matplotlib in python
- In Matplotlib, what does the argument mean in fig.add_subplot(111)?
- How can I plot a confusion matrix? [duplicate]
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- matplotlib error – no module named tkinter
- Python,IndexError: arrays used as indices must be of integer (or boolean) type
- How to change the font size on a matplotlib plot
- How to resolve TypeError: ‘No Numeric Data to Plot’, when numeric data exists in Python
- How do I set the figure title and axes labels font size in Matplotlib?
- How to customize a scatter matrix to see all titles?
- Is there a list of line styles in matplotlib?
- How can one display an image using cv2 in Python
- matplotlib error – no module named tkinter
- Plotting multiple different plots in one figure using Seaborn
- Plot pie chart and table of pandas dataframe
- ModuleNotFoundError: No module named ‘matplotlib’
- Change figure size and figure format in matplotlib
- Add Legend to Seaborn point plot
- TypeError: ‘DataFrame’ object is not callable
- How do I plot only a table in Matplotlib?
- Overcome ValueError for empty array
- Using %matplotlib notebook after %matplotlib inline in Jupyter Notebook doesn’t work
- How to change a ‘LinearSegmentedColormap’ to a different distribution of color?
- Display image as grayscale using matplotlib
- matplotlib using twinx and twiny together (like twinxy)
- reducing number of plot ticks
- How to increase plt.title font size?
- How to draw vertical lines on a given plot in matplotlib
- How can I set the aspect ratio in matplotlib?
- python SyntaxError: invalid syntax %matplotlib inline
- How to make a histogram from a list of data
- How do I change the figure size with subplots?
- ValueError: x and y must be the same size
- ValueError: Unknown projection ‘3d’ (once again)
- raise LinAlgError(“SVD did not converge”) LinAlgError: SVD did not converge in matplotlib pca determination
- TypeError: Invalid dimensions for image data when plotting array with imshow()
- matplotlib does not show my drawings although I call pyplot.show()
- Linear regression with matplotlib / numpy
- How to save a Seaborn plot into a file
- matplotlib: how to draw a rectangle on image
- bbox_to_anchor and loc in matplotlib
- matplotlib: RuntimeError: Python is not installed as a framework
- How can I set the ‘backend’ in matplotlib in Python?
- Install Plotly in Anaconda
- How to put the legend out of the plot
- Matplotlib: TypeError: can’t multiply sequence by non-int of type ‘numpy.float64’
- RuntimeError: Invalid DISPLAY variable
- How to plot an array in python?
- When I use matplotlib in jupyter notebook,it always raise ” matplotlib is currently using a non-GUI backend” error?
- IndexError: index 2 is out of bounds for axis 0 with size 2
- Plot a histogram such that the total area of the histogram equals 1
- How to change legend size with matplotlib.pyplot
- An equivalent function to matplotlib.mlab.bivariate_normal
- plot a circle with pyplot
- Plotting a python dict in order of key values
- Pandas dataframe groupby plot
- MovieWriter ffmpeg unavailable; trying to use class ‘matplotlib.animation.PillowWriter’ instead
- Equivalent to matlab’s imagesc in matplotlib? [duplicate]
- KeyError: ‘plotly_domain’
- TypeError: zip argument #2 must support iteration
- alueError: ordinal must be >= 1