-1

I have two CSV files that produce a raster image, each are 300x300.

I can get the program to display one, but if I try to display both, it just produces a blank white graph. All I want it to show is the two sets of data as separate images, it does not need to be changed in any way.

import csv
import matplotlib.pyplot as plt
import math

lidar = []  # height of object
radar = []  # texture of object

with open('lidar1.csv', newline='') as f:
    reader = csv.reader(f, quoting=csv.QUOTE_NONNUMERIC)
    for row in reader:
        rowlist = []
        for value in row:
            rowlist.append(value) 
        lidar.append(rowlist)


with open('radar1.csv', newline='') as f:
    reader = csv.reader(f, quoting=csv.QUOTE_NONNUMERIC)
    for row in reader:
        rowlist = []
        for value in row:
            rowlist.append(value) 
        radar.append(rowlist)

plt.imshow(lidar) 

2

2 Answers 2

0

You can use plt.show to plot each figure separately:

plt.imshow(lidar) 
plt.show()
plt.imshow(radar)
plt.show()

Or do like @norok2 suggested by using subplots

fig, ax = plt.subplots(1, 2, figsize = [10, 20])
ax[0].imshow(lidar)
ax[1].imshow(radar)
plt.show()
Sign up to request clarification or add additional context in comments.

Comments

0

You need to create 2 figures so that they display separately as so.

f1 = plt.figure()
plt.plot(lidar)
f2 = plt.figure()
plt.plot(rowlist)

1 Comment

when i do that, i get two separate figures displayed as a line graph, rather than two raster images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.