Python Forum
coding help!!! - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: coding help!!! (/thread-34580.html)



coding help!!! - zero1 - Aug-11-2021

how to plot graph without using any lib


RE: coding help!!! - ndc85430 - Aug-11-2021

Why don't you want to use a library? There's no point reinventing the wheel, when good wheels exist.


RE: coding help!!! - Gribouillis - Aug-11-2021

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.


RE: coding help!!! - zero1 - Aug-11-2021

without lib means without using graph library like matplotlib


RE: coding help!!! - Gribouillis - Aug-11-2021

If you can import tkinter with python, you could draw the graph in a tkinter canvas.


RE: coding help!!! - jamesaarr - Aug-11-2021

Hello,

It is so much harder to plot graphs without using libraries such as matplotlib, why don't you want to use it?


RE: coding help!!! - jefsummers - Aug-11-2021

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


RE: coding help!!! - tester_V - Aug-12-2021

I understand you probably cannot install libs, because of the firewall and so on...
But there are some other 'ways' to install the libs...


RE: coding help!!! - deanhystad - Aug-12-2021

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.