0

I have a contourf plot and a matplotlib.collections.LineCollection as mc plot that I drew on top of each other on the same axis but they aren't exactly on top in the case where one is shifted to the left from the other what can I do to make them be exactly on top of each other?

Here is how my plot looks like :

enter image description here

Where the parts of the blue lines are plottted using LinesCollection and the red plot using the contourf plot.

Mahmoud Ayman
  • 197
  • 1
  • 13
  • 2
    Your `contourf` data (in both the `x` and `y` directions) seems to go from 0 to 99 instead of 0 to 100. Meanwhile, the LineCollections endpoints seem to extend to 100. You could fix the problem by extending your `contourf` data to include 100, but the devil is in the details. It would be helpful to see your code. – unutbu May 10 '15 at 13:33
  • @unutbu You're right :O I truly did that in my meshgrid code: `x_list = np.linspace(0, 99, 100) #THE START AND END SHOULD BE ACCORDING TO THE ROOM WHICH ARE X_MIN,X_MAX,Y_MIN,Y_MAX y_list = np.linspace(0, 99, 100)` Should I change the x_list and y_list to np.linespace(0,100,101) instead? – Mahmoud Ayman May 10 '15 at 13:39
  • 1
    Try it. That sounds like it might be the solution. – unutbu May 10 '15 at 13:40
  • @unutbu Thank you man that helped and fixed my problem appreciate it :) – Mahmoud Ayman May 10 '15 at 14:02
  • @MahmoudAyman Can you write that up as an answer to your own question? – tacaswell May 11 '15 at 03:04

1 Answers1

0

Your contourf data (in both the x and y directions) seems to go from 0 to 99 instead of 0 to 100. Meanwhile, the LineCollections endpoints seem to extend to 100. You could fix the problem by extending your contourf data to include 100, but the devil is in the details. It would be helpful to see your code. – unutbu 20 hours ago

Mahmoud Ayman
  • 197
  • 1
  • 13