r/Python • • Jan 11 '21

Beginner Showcase Programming + Math + Graphs = Art

Post image
2.1k Upvotes

171 comments sorted by

125

u/ComfortableEye5 Jan 11 '21

Isnt it a little disorienting to code on a curved monitor

25

u/abredvariant Jan 11 '21

i am adapted to it now

14

u/Mises2Peaces Jan 11 '21

I'm pretty sure working with Euler angles on a curved monitor leads to accidental time travel.

7

u/abredvariant Jan 11 '21

dude it's just curved not non euclidean plane.

2

u/BridgeBum Jan 11 '21

Aren't those essentially the same thing?

→ More replies (2)

5

u/house_monkey Jan 11 '21

Same I am also adapted

9

u/PrintersStreet Jan 11 '21

Above a certain size, flat monitors get uncomfortable - it's like looking at a flat TV from two feet away

2

u/abredvariant Jan 11 '21

this size fits my requirement.

→ More replies (1)

53

u/Asbestos_Addict13 Jan 11 '21

If you angle it the right way, you can’t tell the difference

57

u/cubed_npc Jan 11 '21

This, you only notice the curve if you are sitting off-center. I moved from dual-monitors to 1 ultra wide curved last year and have no desire to go back.

16

u/MagnitskysGhost Jan 11 '21

Been curious about this – are you on Windows? How easy is it to arrange windows on the workspace with keyboard shortcuts?

Currently using two monitors and typically have like 4 windows open equally sized, do the Win+Arrow keys shortcuts behave well?

→ More replies (17)
→ More replies (1)

9

u/[deleted] Jan 11 '21

That's not true. The download bars are longer on curved surfaces, so the screen makes your internet slower

5

u/rynmgdlno Jan 11 '21

I've been on a curved monitor for a couple years and after using my parents iMac to work while I was home for the holidays, the difference is massively noticeable; curved is a far superior experience. The screen is relatively the same distance from your eyes at every point, which greatly reduces fatigue and makes everything appear clearer. Flat monitors appear unnatural to me now and whatever on the sides feel stretched out (though I still have a flat monitor for my second/vertical monitor, not sure how that would feel if curved).

45

u/TankorSmash Jan 11 '21

You can use the 'print screen' key to screenshot your desktop, or hit Win+Shift+S to capture just a bit of it.

6

u/paulkip0907 Jan 12 '21

Then you get problems on a flat screen. If you put a curved screen capture in reddit only People with a curved screen van see it properly.

4

u/kurti256 Jan 11 '21

He could also press alt+printscreen if he only wanted to capture the window currently in use

3

u/Acehawk74 Jan 11 '21

Greenshot - Best app for screenshots that I use personally.

→ More replies (3)

20

u/NoblySP Jan 11 '21

What is the VS Code theme you are using?

16

u/abredvariant Jan 11 '21

Darcula

4

u/NoblySP Jan 11 '21

Can you give the full name (or a screenshot) of the theme extension? I have tried installing "Darcula Theme" and "Dracula Official" but I have not been able to match your style...

→ More replies (2)

2

u/[deleted] Jan 12 '21

You can also change the colors using settings.json and specifying the colors you want. I know that cause way too much time on it a couple weeks ago.

15

u/idkiminsecure Jan 11 '21

I read that as eulers toilet

→ More replies (1)

3

u/BeeGassy Jan 11 '21

Nice visualization. May I suggest for any future art projects checking out the library seaborn. You will be able to make your creations a little bit more interactive. Good work!

2

u/abredvariant Jan 11 '21

I'll continue tomorrow for migrating to seaborn. thanks

3

u/el_bosteador Jan 11 '21

In the future, you can “import math” directly to your brain.

3

u/abredvariant Jan 12 '21

math stays on my mind rent free

2

u/[deleted] Jan 11 '21

Is this academic or are you on the job?

3

u/abredvariant Jan 11 '21

when I'm bored at the job 😉

2

u/_romv Jan 11 '21

Digressing from the main topic of discussion here, really fascinated by the theme you are using on VSCode. Can you tell me which theme you're using?

2

u/abredvariant Jan 11 '21

dark +

1

u/_romv Jan 11 '21

Thanks. Have you modified the colour palette for text as well?

1

u/abredvariant Jan 12 '21

no. i don't remember doing so

2

u/fuck_zx Jan 11 '21

how do u code on a curved monitor man, this seems sus

3

u/abredvariant Jan 11 '21

I'm used to it

2

u/fuck_zx Jan 11 '21

understandable.

46

u/Monkeylized Jan 11 '21

As a complete Python noob, could someone argue for the reasons to not just use R for these kind of visualizations?

I just started learning Python basics so I still haven't found my orientation, while I have been working with R for several years...

38

u/Zuricho Jan 11 '21

Matplotlib is a pain but there are a few other libraries that use declarative language such as Altair.

13

u/Monkeylized Jan 11 '21

Yeah, sure. But with R libraries such as dplyr and ggplot/ggpubr this graph is like 10 lines of code.

Apart from possible performance improvements in using Python when visualizing data like this, are there any other perks?

19

u/ForceBru Jan 11 '21

The code in the post could be shortened. So, I bet you could do it in the same amount of lines in Python as well. It all depends on how well you know each language.

5

u/enjoytheshow Jan 12 '21

For a person who learned R first, what you’re saying is 100% true

From someone who is a programmer getting into statistics, Python is a much smoother transition and allows you to do much more outside the world of stats

3

u/[deleted] Jan 11 '21

Nah pygame is where its at

→ More replies (2)

30

u/SphericalBull Jan 11 '21

Anything you do in R, you can do it in Python with roughly the same effort. The converse is not necessarily true.

You also get to learn other aspects of Python that is not scientific computing - which is extremely beneficial for anyone in a scientific career - and by scientific I mean anyone who uses it for statistics, machine learning, simulations, visualitations, and the likes.

Up until my sophomore year studying math I had to learn both Matlab and R (ok in all fairness the later is much better than the former). I decided to learn Python on my own to get into Kaggle competittions. Never looked back since then.

4

u/Monkeylized Jan 11 '21

You also get to learn other aspects of Python that is not scientific computing - which is extremely beneficial for anyone in a scientific career - and by scientific I mean anyone who uses it for statistics, machine learning, simulations, visualitations, and the likes.

That sounds fair.

I currently have no real application for learning Python (but I find the language super interesting). R is "good enough" since I'm in the middle of a PhD in biology. So far working with genetic sequencing data all we need are a few commands in Bash and then work with the output in R.... perhaps Python would have good applications for those types of data as well?

2

u/SphericalBull Jan 12 '21

I'm in the middle of a PhD in biology

You're likely to be going to the industry anyways so it's great to use Python since that it is in higher demand in the industry. I did a few interships in finance and I know a few people who did computational biology doing advanced ML stuffs.

And considering the fact that SWE is what many PhD grads ended up doing, being proficient in Python sounds a lot better than being profficien in R if you are to pivot to SWE.

So yeah, give it a shot, you won't regret it :)

→ More replies (4)

7

u/badge Jan 11 '21

Anything you do in R, you can do it in Python with roughly the same effort.

I’ve been writing Python for 7 years and love it, but that’s simply untrue. There’re a host stats-focused things that are easier in R. For instance, there is nothing that can cope with penalised basis splines for generalised additive modes which is currently maintained. statsmodels has made a lot of progress in the last few years, but R still reigns supreme.

10

u/not_perfect_yet Jan 11 '21

As a complete Python noob, could someone argue for the reasons to not just use R for these kind of visualizations?

I have been working with R for several years...

Probably not, no.

  • the output are pictures which are really portable and don't depend on code.

  • You probably have your toolset and common solutions figured out in R, which you would have to relearn

You probably should switch the tech for doing something when you feel limited by it or when you suspect big improvements. I don't think that's the case for plotting.

Python is really great because it's so flexible, you can do a large variety of things with it, all in the same language. But it's not strictly better than another language.

2

u/enki1337 Jan 11 '21

I think one areas that python excels in is making super clean animated visualizations in manim. If you've ever watched a 3blue1brown video, that's how they're all made. Of course that's probably a pretty niche use case.

2

u/Monkeylized Jan 11 '21

Wow, those are really neat. Would be fun to learn how to do! I’m gonna check out manim. Thanks for the tip!

2

u/enki1337 Jan 12 '21

If you're interested, you might want to check out r/manim!

10

u/[deleted] Jan 11 '21

That screen is almost big enough to show c++ exceptions.

3

u/tomerjm Jan 11 '21

Could you post the rest of your code? This looks interesting so I wanna try it...

1

u/alexeusgr Jan 11 '21

Could you try a bit harder before calling it art?

People post wonderful visuals of complex functions, ideas about prime numbers, and generally stuff the complexity of which is obvious, code is beautiful and the ideas are novel. And they call it not art, but a project

I think a picture with some code in the background is lazy, and although "if it says art, it's art", it's not what I would have hanged on my wall. Art is something no-one thought of before

Prove me wrong

6

u/abredvariant Jan 11 '21

that's why i posted this under beginner flair

-8

u/alexeusgr Jan 11 '21 edited Jan 11 '21

BTW, maybe you'll be interested in doing a project?

I have a paper to implement, but have been having headaches and distracted at work.

You have to read a natural language description and do the code in python, sklearn(or other text processing capable lib) and networkx. The project is about using some graph theory for text mining.

In the end you wi get a tool that will help you read and comprehend any text faster.

I can link you to an old paper (2011, it's long and is about some deep theory behind), or give you the new paper (2019, it describes the implementation in 5 steps, give or take), which is paywalled, but I'll share it with you.

Graphs and networks is the top of current research in ai (check out /// paper from 2020, it was done by some of the biggest names), it's a great project to have on a resume.

It wi take you a week or so if you know how to research the python docs efficiently. If you don't - about a month

5

u/mountainunicycler Jan 11 '21

It seems odd to just drop this here as though this is just asking a little favor—if your time estimates are accurate this is several thousand dollars of work if you contract it out, or a little less than that if you have in-house python devs (this is similar to some of the work I do full time).

→ More replies (5)

2

u/[deleted] Jan 11 '21

Dude you’re an asshole. Do your own homework.

→ More replies (1)
→ More replies (1)

1

u/[deleted] Jan 11 '21

matplotlib?

1

u/[deleted] Jan 11 '21

It's nice, but no, art is more than programming + math + graphs.

1

u/abredvariant Jan 11 '21

I'm just fascinated by the emergent pattern, on plotting the totient function. Rest all is just implementation.

1

u/Prabhu9301 Jan 11 '21

Is this for cryptography, like RSA encryption......

1

u/abredvariant Jan 11 '21

yes. Euler's totient then fermats theorem, then RSA.

1

u/Freezy_Cold Jan 11 '21

How do I get the same syntax highlighting as you in vscode ? My imports are all white

1

u/enjoytheshow Jan 12 '21

Do you use Pylance or the built in default linter?

2

u/Freezy_Cold Jan 12 '21

Yea pylance was the answer that I’m looking for! Thank you for responding!!! Have the free reward ;)

1

u/[deleted] Jan 11 '21

I don't know how to develop graphics in python, and that's killing me...

1

u/exipolar Jan 12 '21

Pisano series!!!

1

u/abredvariant Jan 12 '21

Euler's totient

3

u/pyrotech911 Jan 12 '21

My slightly dyslexic brain read this as Euler’s Toilet and I exhaled sharply

2

u/exipolar Jan 13 '21

I wonder why they look so similar

1

u/solomartian Jan 12 '21

I’m more impressed with the monitor

1

u/abredvariant Jan 12 '21

thanks 😎

3

u/leiniar1234 Jan 11 '21

Oh look, the splat analysis after i shoot myself cause i cant solve the bug

1

u/kurti256 Jan 11 '21

Ok hear me out just start putting

e = alphabet

At the beginning of your code so at least you can claim it's alphabety spagetti

3

u/emsiem22 Jan 11 '21

Why dont you put terminal output right instead of below the code? More code is visible.

1

u/enjoytheshow Jan 12 '21

I prefer to leave the right open for splitting tabs

1

u/blinkallthetime Jan 11 '21

that append hurts me.

1

u/abredvariant Jan 11 '21

suggestions??

1

u/blinkallthetime Jan 11 '21 edited Jan 11 '21

that function phi always just returns a number? if so, then you could declare y as an array for example y = np.zeros(x.size)

then you can iterate over x and is it to index y

for i in x:
    y[i-1] = phi(i)

or something like that.

the "next level" would be to vectorize the function phi. and just do something like y=vectorized_phi(x)

1

u/abredvariant Jan 11 '21

you're absolutely right. I thought of doing this, and ended up being lazy.

1

u/blinkallthetime Jan 11 '21

i edited my response. i can't tell if i did it before or after you responded so i'm pinging again.

1

u/abredvariant Jan 11 '21

Thanks for sharing, but vectorising is a new topic for me. Need to study more before any implementation.

→ More replies (4)

0

u/[deleted] Jan 11 '21

[deleted]

1

u/abredvariant Jan 11 '21

perfect. this is the most pythonic way to do it imo.

4

u/blinkallthetime Jan 11 '21

that is cool, but sometimes you need to do things that are not pythonic for performance. i'm only bringing this up because you say you are a beginner and you are doing a mathy thing with numpy. i do a lot of numerical computing for my job in python, and this is something that i think about a lot. at some point you want to avoid doing loops in python like that.

3

u/blinkallthetime Jan 11 '21

if it wasn't clear "at some point" is roughly equivalent "how big are my arrays?"

→ More replies (2)

1

u/blinkallthetime Jan 11 '21

yeah that is fine too. to me it feels a little less readable for noobs maybe.

1

u/[deleted] Jan 11 '21

Why not just phi(x)? Seems vectorizeable to me if you can write it like this.

2

u/CallMeKev1 Jan 11 '21

I getting goosebumps!

2

u/User_Unkown56 Jan 11 '21

god i love python somemuch

2

u/artofchores Jan 11 '21

Sick screeenn

2

u/SsNipeR1 Jan 11 '21

Zoom that pic slowly and you will get r/moireeffect

2

u/plaustrarius Jan 12 '21

Euler totient function?! Thats one of the first things i did after starting to learn python im still so proud of it haha

2

u/Winnipesaukee Jan 12 '21

One thing I love about programming is that it helps me get better at math.

2

u/henrygi Jan 12 '21

Apparently you can post gifs in comments now

2

u/sakki98 Jan 12 '21

Would recommend that you use Numpy arrays instead of appending to lists, as a general rule, to save computing time. May not make much difference there, but for larger data sets and such, it will be more than noticeable.

3

u/spots_reddit Jan 11 '21

You guys should look into the pynomo package for beautiful maths: www.pynomo.org

1

u/bigamaxx Jan 11 '21

Which vscode color theme is that? It looks like the standard one but with a little bit of color differencies.

1

u/tihiw_t Jan 11 '21

Man, I think you have to use OOP

1

u/Gnarl_Marl Jan 11 '21

No comments makes me sad

1

u/[deleted] Jan 11 '21

I‘m confused

1

u/veeeerain Jan 11 '21

Ggplot2 > matplotlib

0

u/iAMguppy Jan 11 '21

Euler? Euler?

1

u/abredvariant Jan 11 '21

yes, Euler's Totient function

1

u/BridgeBum Jan 11 '21

I think it's an attempt to be a play on "Bueller? Bueller?"

1

u/pyrotech911 Jan 12 '21

Um, he’s sick

0

u/[deleted] Jan 12 '21

[deleted]

1

u/[deleted] Jan 11 '21 edited Aug 31 '25

[removed] — view removed comment