Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
coding help!!!
#1
how to plot graph without using any lib
Reply
#2
Why don't you want to use a library? There's no point reinventing the wheel, when good wheels exist.
buran likes this post
Reply
#3
You could perhaps give us details about the graph that you want to plot, your device and operating system and what you mean by not using any library.
Reply
#4
without lib means without using graph library like matplotlib
Reply
#5
If you can import tkinter with python, you could draw the graph in a tkinter canvas.
Reply
#6
Hello,

It is so much harder to plot graphs without using libraries such as matplotlib, why don't you want to use it?
while dad_has_cigs == True:
    happiness = True
    if dad_has_cigs == False:
    print("Dad come home!")
    happiness = not happiness
    break
Reply
#7
You did not say what kind of graph, let me guess (always a bad idea) that you want a scatter plot.
Scale the data
Choose a monospace font
"Plot" stars at the data points by printing them
Reply
#8
I understand you probably cannot install libs, because of the firewall and so on...
But there are some other 'ways' to install the libs...
Reply
#9
Bar charts are probably the easiest to do:
data = {
    'Bread':11,
    'Butter':16,
    'Beans':5,
    'Barley':2
}

for category, value in data.items():
    print(f'{category:<10}:', '*'*value)
Output:
Bread : *********** Butter : **************** Beans : ***** Barley : **
Anything else is much harder using ascii.

You could write a fairly simple line plotter using tkinter canvas and lines.
Reply


Forum Jump:

User Panel Messages

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