Python Forum
Inserting a variable name into xlabel
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inserting a variable name into xlabel
#1
Hi, first post here.

I am trying to streamline a lot of data processing by using a class of objects called "image". I define each image as "image1 = image(...), image2 = ..." and so on.

class image(self, path):
...
image1 = image('pathway')
I am looking to plot data that can be distinguished from each image, but I can't seem to figure out how to insert a variable value that isn't a number. Would it look something close to this:

plt.xlabel("pixels (x), %" % self)
where self is the image name (ie image1, image2...)?

The errors that keep popping up only relate to the type of value it should be:
"must be real number, not image"

If I can't get a word in there, I can always just add an assigned number to the class values or whatever. But I would prefer the actual name for this.

Thank you!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reportlab: Add xlabel, ylabel and grid to lineplot denissanga 2 6,343 Dec-19-2017, 04:48 PM
Last Post: denissanga

Forum Jump:

User Panel Messages

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