Python Forum

Full Version: coding help!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how to plot graph without using any lib
Why don't you want to use a library? There's no point reinventing the wheel, when good wheels exist.
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.
without lib means without using graph library like matplotlib
If you can import tkinter with python, you could draw the graph in a tkinter canvas.
Hello,

It is so much harder to plot graphs without using libraries such as matplotlib, why don't you want to use it?
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
I understand you probably cannot install libs, because of the firewall and so on...
But there are some other 'ways' to install the libs...
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.