Python Forum
xtick vetical not working
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
xtick vetical not working
#1
Hi

I am new to pyhton. I wrote a script for time series plot with two y axis. In that script xtick vertical is not working. And I am getting only one legend out of three. Input file contains four column (Date, mean, rms, count). script is like

import numpy as np
import datetime
import matplotlib.pyplot as plt
data=np.loadtxt('file.txt',skiprows=1)
base = datetime.datetime(2018,02,14)
x = [base - datetime.timedelta(days=x) for x in range(0, 16)]
fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
ax1.plot(x,data[:,1],'r',label="mean")
ax1.plot(x,data[:,2],'b',label="rms")
ax2.plot(x,data[:,3],'g',label="count")
plt.xticks(rotation='vertical')
ax1.set_xlabel('Date',fontsize=14)
ax1.set_ylabel('Mean/ RMS', fontsize=14,color='r')
ax2.set_ylabel('count', fontsize=14,color='b')
plt.legend()
Reply
#2
For helping, we need the input file.
Reply
#3
Or a link to the input file.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020