Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8542117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:59:12+00:00 2026-06-11T11:59:12+00:00

In Python, I have a 2D array, e.g.: 1.3 5.7 3.2 5.6 2.3 9.5

  • 0

In Python, I have a 2D array, e.g.:

1.3 5.7 3.2
5.6 2.3 9.5
1.1 4.1 5.2

I then used ‘imshow’ to get what I needed – I essentially had a plot where the x axis was:
(column) 0 (column) 1 (column) 2 ….

and the y axis was:
.
.
(row) 2
(row) 1
(row) 0

and then the actual values (5.6 or 2.3 or whatever) were represented by colours, which was just what I wanted.

But then later, instead of the x axis just being column 0 column 1 and column 2 etc., I wanted the x axis to show the date which corresponds to column 0 column 1 and column 2 etc.. This information was stored in a different list, say “date_info[]”.

So instead of an arbitrary indexing scheme on the bottom, I want the x values of the imshow to correspond to the values of the date_info[] list – instead of the number 2 for example, I wanted date_info[2] on the x axis.

Now with the help of this forum, I was able to do this using:

plt.xticks(mjdaxis,[int(np.floor(data_info[i])) for i in mjdaxis])

which was sufficient for a while, but I am just changing the labels of the x axis here right? rather than what is being plotted. Now when I am trying to lay one other plot (just a regular curve) on top of my original, the x axis scaling gets messed up, and my columns get bunched up as (1,2,3…) again, instead of their corresponding date_info values (55500, 55530, 55574…)

If anyone can make any sense of what I am saying, that would be great!!

For reference, here is the code that I am now trying:

fig = plt.figure()
ax1 = fig.add_subplot(111)
mjdaxis=np.linspace(0,date_info[0]-1,20).astype('int')
ax1.set_xticks(mjdaxis,[int(np.floor(date_info[i])) for i in mjdaxis])
ax1.imshow(residuals, aspect="auto")

ax2 = ax1.twinx()
ax2.plot(pdot[8:,0],pdot[8:,1])

plt.show()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:59:13+00:00Added an answer on June 11, 2026 at 11:59 am

    If I understand you correctly, you should be able to just add the line ax2.set_xticks([]) before your plt.show(). You might also want to read up on the kwarg hold.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of Python objects, and I would like to get all
I have the following array(in python): arr= ['\n', ' a#B\n', ' c#D\n'] Now I
I have a 3D array in Python and I need to iterate over all
I have a char array in Python, which is read from a file e.g.
I am creating an object in python. I have a numpy array from an
I have a problem with initialzing a 2D array in python. I want a
I have a csv file being read into python, I then save the reader
I am new in python.I have data in a 2d- array in the following
So i have the following code which is an array of python dictionaries userInfo.append({userType:blah,
I have created a simple function in python: def func(a,x): return a+x*2 and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.