Arduino serial data heatmap plot in pythonHow do I check whether a file exists without exceptions?Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow to make a flat list out of list of lists?Does Python have a string 'contains' substring method?

What if a revenant (monster) gains fire resistance?

On a tidally locked planet, would time be quantized?

Lowest total scrabble score

Did arcade monitors have same pixel aspect ratio as TV sets?

Does a 'pending' US visa application constitute a denial?

WiFi Thermostat, No C Terminal on Furnace

Creature in Shazam mid-credits scene?

Why did the HMS Bounty go back to a time when whales are already rare?

What should you do when eye contact makes your subordinate uncomfortable?

When were female captains banned from Starfleet?

How could a planet have erratic days?

Should I stop contributing to retirement accounts?

Why should universal income be universal?

Why electric field inside a cavity of a non-conducting sphere not zero?

C++ debug/print custom type with GDB : the case of nlohmann json library

How should I respond when I lied about my education and the company finds out through background check?

Is there a working SACD iso player for Ubuntu?

Drawing ramified coverings with tikz

If a character has darkvision, can they see through an area of nonmagical darkness filled with lightly obscuring gas?

Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?

How to explain what's wrong with this application of the chain rule?

Is it possible to have a strip of cold climate in the middle of a planet?

Why is it that I can sometimes guess the next note?

Yosemite Fire Rings - What to Expect?



Arduino serial data heatmap plot in python


How do I check whether a file exists without exceptions?Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow to make a flat list out of list of lists?Does Python have a string 'contains' substring method?













0















I am receiving an array of 32 floating numbers from arduino serial monitor into python using pyserial. Further, I want to plot an annotated heatmap with numbers (temperature values) received from arduino serial monitor. I am able to receive the temperature values in python shell and also in the heatmap. But the challenge I am facing is I think the values are not synchronous i.e What I should do to map the cells with specific values.



I am attaching the code below:



enter image description here



import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import serial
import time

tempdata = serial.Serial("COM8",38400,timeout=0.1)
strn = []

rows = ["A","B","C","D"]
columns = ["1", "2", "3", "4",
"5", "6", "7","8"]

tempsArray = np.empty((1,32))

plt.ion()

fig, ax = plt.subplots()
# The subplot colors do not change after the first time
# if initialized with an empty matrix
im = ax.imshow(np.random.rand(4,8),cmap='plasma')

# Axes ticks
ax.set_xticks(np.arange(len(columns)))
ax.set_yticks(np.arange(len(rows)))
# Axes labels
ax.set_xticklabels(columns)
ax.set_yticklabels(rows)
# Rotate the tick labels and set their alignment.
plt.setp(ax.get_xticklabels(), rotation=45, ha="right",
rotation_mode="anchor")

ax.set_title("")

fig.tight_layout()

text = []

while True: #Makes a continuous loop to read values from Arduino

tempdata.flush()
strn = tempdata.readline()[:] #reads the value from the serial port as a
string
tempsString = np.asarray(strn)
tempsFloat = np.fromstring(tempsString, dtype=float, sep= ',')

tempsArray.flat=tempsFloat
print(tempsArray)
im.set_array(tempsArray)

#Delete previous annotations
for ann in text:
ann.remove()
text = []

#Loop over data dimensions and create text annotations.
for i in range(len(rows)):
for j in range(len(columns)):
text.append(ax.text(j, i, tempsArray[i, j],
ha="center", va="center", color="b"))

# allow some delay to render the image
plt.pause(0.1)

plt.ioff()









share|improve this question



















  • 1





    Yeah i solved it. Will post the github link if anyone needs it.

    – tshivam
    Oct 10 '18 at 4:53















0















I am receiving an array of 32 floating numbers from arduino serial monitor into python using pyserial. Further, I want to plot an annotated heatmap with numbers (temperature values) received from arduino serial monitor. I am able to receive the temperature values in python shell and also in the heatmap. But the challenge I am facing is I think the values are not synchronous i.e What I should do to map the cells with specific values.



I am attaching the code below:



enter image description here



import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import serial
import time

tempdata = serial.Serial("COM8",38400,timeout=0.1)
strn = []

rows = ["A","B","C","D"]
columns = ["1", "2", "3", "4",
"5", "6", "7","8"]

tempsArray = np.empty((1,32))

plt.ion()

fig, ax = plt.subplots()
# The subplot colors do not change after the first time
# if initialized with an empty matrix
im = ax.imshow(np.random.rand(4,8),cmap='plasma')

# Axes ticks
ax.set_xticks(np.arange(len(columns)))
ax.set_yticks(np.arange(len(rows)))
# Axes labels
ax.set_xticklabels(columns)
ax.set_yticklabels(rows)
# Rotate the tick labels and set their alignment.
plt.setp(ax.get_xticklabels(), rotation=45, ha="right",
rotation_mode="anchor")

ax.set_title("")

fig.tight_layout()

text = []

while True: #Makes a continuous loop to read values from Arduino

tempdata.flush()
strn = tempdata.readline()[:] #reads the value from the serial port as a
string
tempsString = np.asarray(strn)
tempsFloat = np.fromstring(tempsString, dtype=float, sep= ',')

tempsArray.flat=tempsFloat
print(tempsArray)
im.set_array(tempsArray)

#Delete previous annotations
for ann in text:
ann.remove()
text = []

#Loop over data dimensions and create text annotations.
for i in range(len(rows)):
for j in range(len(columns)):
text.append(ax.text(j, i, tempsArray[i, j],
ha="center", va="center", color="b"))

# allow some delay to render the image
plt.pause(0.1)

plt.ioff()









share|improve this question



















  • 1





    Yeah i solved it. Will post the github link if anyone needs it.

    – tshivam
    Oct 10 '18 at 4:53













0












0








0








I am receiving an array of 32 floating numbers from arduino serial monitor into python using pyserial. Further, I want to plot an annotated heatmap with numbers (temperature values) received from arduino serial monitor. I am able to receive the temperature values in python shell and also in the heatmap. But the challenge I am facing is I think the values are not synchronous i.e What I should do to map the cells with specific values.



I am attaching the code below:



enter image description here



import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import serial
import time

tempdata = serial.Serial("COM8",38400,timeout=0.1)
strn = []

rows = ["A","B","C","D"]
columns = ["1", "2", "3", "4",
"5", "6", "7","8"]

tempsArray = np.empty((1,32))

plt.ion()

fig, ax = plt.subplots()
# The subplot colors do not change after the first time
# if initialized with an empty matrix
im = ax.imshow(np.random.rand(4,8),cmap='plasma')

# Axes ticks
ax.set_xticks(np.arange(len(columns)))
ax.set_yticks(np.arange(len(rows)))
# Axes labels
ax.set_xticklabels(columns)
ax.set_yticklabels(rows)
# Rotate the tick labels and set their alignment.
plt.setp(ax.get_xticklabels(), rotation=45, ha="right",
rotation_mode="anchor")

ax.set_title("")

fig.tight_layout()

text = []

while True: #Makes a continuous loop to read values from Arduino

tempdata.flush()
strn = tempdata.readline()[:] #reads the value from the serial port as a
string
tempsString = np.asarray(strn)
tempsFloat = np.fromstring(tempsString, dtype=float, sep= ',')

tempsArray.flat=tempsFloat
print(tempsArray)
im.set_array(tempsArray)

#Delete previous annotations
for ann in text:
ann.remove()
text = []

#Loop over data dimensions and create text annotations.
for i in range(len(rows)):
for j in range(len(columns)):
text.append(ax.text(j, i, tempsArray[i, j],
ha="center", va="center", color="b"))

# allow some delay to render the image
plt.pause(0.1)

plt.ioff()









share|improve this question
















I am receiving an array of 32 floating numbers from arduino serial monitor into python using pyserial. Further, I want to plot an annotated heatmap with numbers (temperature values) received from arduino serial monitor. I am able to receive the temperature values in python shell and also in the heatmap. But the challenge I am facing is I think the values are not synchronous i.e What I should do to map the cells with specific values.



I am attaching the code below:



enter image description here



import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import serial
import time

tempdata = serial.Serial("COM8",38400,timeout=0.1)
strn = []

rows = ["A","B","C","D"]
columns = ["1", "2", "3", "4",
"5", "6", "7","8"]

tempsArray = np.empty((1,32))

plt.ion()

fig, ax = plt.subplots()
# The subplot colors do not change after the first time
# if initialized with an empty matrix
im = ax.imshow(np.random.rand(4,8),cmap='plasma')

# Axes ticks
ax.set_xticks(np.arange(len(columns)))
ax.set_yticks(np.arange(len(rows)))
# Axes labels
ax.set_xticklabels(columns)
ax.set_yticklabels(rows)
# Rotate the tick labels and set their alignment.
plt.setp(ax.get_xticklabels(), rotation=45, ha="right",
rotation_mode="anchor")

ax.set_title("")

fig.tight_layout()

text = []

while True: #Makes a continuous loop to read values from Arduino

tempdata.flush()
strn = tempdata.readline()[:] #reads the value from the serial port as a
string
tempsString = np.asarray(strn)
tempsFloat = np.fromstring(tempsString, dtype=float, sep= ',')

tempsArray.flat=tempsFloat
print(tempsArray)
im.set_array(tempsArray)

#Delete previous annotations
for ann in text:
ann.remove()
text = []

#Loop over data dimensions and create text annotations.
for i in range(len(rows)):
for j in range(len(columns)):
text.append(ax.text(j, i, tempsArray[i, j],
ha="center", va="center", color="b"))

# allow some delay to render the image
plt.pause(0.1)

plt.ioff()






python arduino heatmap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 10 '18 at 1:30









Mahendra Gunawardena

1,52651937




1,52651937










asked Oct 8 '18 at 10:45









tshivamtshivam

204




204







  • 1





    Yeah i solved it. Will post the github link if anyone needs it.

    – tshivam
    Oct 10 '18 at 4:53












  • 1





    Yeah i solved it. Will post the github link if anyone needs it.

    – tshivam
    Oct 10 '18 at 4:53







1




1





Yeah i solved it. Will post the github link if anyone needs it.

– tshivam
Oct 10 '18 at 4:53





Yeah i solved it. Will post the github link if anyone needs it.

– tshivam
Oct 10 '18 at 4:53












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52700579%2farduino-serial-data-heatmap-plot-in-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52700579%2farduino-serial-data-heatmap-plot-in-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко