r/Python • • Aug 05 '19

Python's response to MATLAB

Post image
4.3k Upvotes

372 comments sorted by

View all comments

Show parent comments

405

u/Alexanderdaawesome Aug 05 '19

Because Python needs to type

import numpy as np

Before doing anything MATLAB can do.

0

u/[deleted] Aug 05 '19

[deleted]

82

u/[deleted] Aug 05 '19

You can write templates that do that for you, saving you literally seconds of drudgery!

32

u/ItsOk_ImYourDad Aug 05 '19

I have no legacy

29

u/[deleted] Aug 05 '19

Sure you do, dad, you've got me

36

u/Fratboy_Slim Aug 05 '19

Like he said, no legacy

7

u/ItsOk_ImYourDad Aug 05 '19

Good one slim

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

34

u/mexiKobe Aug 05 '19

matplotlib’s decision to include MATLAB-like state machine plotting was really stupid. It used to be extremely confusing and I would just write to file and use GNUplot

34

u/SuspiciousScript Aug 05 '19

It used to be extremely confusing

it definitely still is

13

u/mexiKobe Aug 05 '19

well what I mean is at least now that Python is being used widely for numerical calculations that there are tutorials that talk about it. When I started using matplotlib in like 2011 it felt like a total mystery.

0

u/[deleted] Aug 05 '19

[deleted]

9

u/mexiKobe Aug 05 '19

you must have been doing simple plots because as soon as you needed to really customize things you had to start calling methods

→ More replies (5)
→ More replies (11)

4

u/Thecrawsome Aug 05 '19

matplotlib requires more boilerplate than Matlab for regular graphing. especially if you're making a node graph or something.

with that being said, i still can't stand Matlab

(I'm open to correction)

4

u/[deleted] Aug 05 '19

Don't forget, in some environments, you'll also need

%matplotlib inline
→ More replies (4)
→ More replies (3)

17

u/stoirtap Aug 05 '19

Hi, Engineering newb here.

I've got some experience with Python and MATLAB (through my school). Being the newb that I am, my favorite part of MATLAB is that it shows me all the variables and what's in them on the side, so if the wrong thing is going to the wrong place, I'll know at once.

Does Python have something like that?

77

u/djingrain Aug 05 '19

That's more of an IDE feature than a language feature, if I'm understanding correctly, so if you use the right IDE, sure, the thing I understand about Matlab is that it locks you into their IDE

8

u/GuybrushThreepwo0d Aug 05 '19

You are not locked into an IDE with matlab. I use vim as my editor and run scripts from the command line.

9

u/ThwompThwomp Aug 05 '19

emacs Matlab'er reporting in as well. It's a much better experience from emacs than mathworks' bloated java gui, but sometimes their line-by-line debugging tools are pretty nice.

→ More replies (5)

48

u/tikael Aug 05 '19

Check out Spyder, it has a built in console and does what you want out of the box. You can get it and a full Python install ready for most scientific and engineering uses by installing Anaconda.

It's not my favorite editor, that'd be sublime text but it requires a bit more know-how and set up than Spyder.

→ More replies (6)

30

u/sssmmt Aug 05 '19

Install Pycharm (pro version is free if you're a student) and activate Scientific Mode.

https://www.jetbrains.com/help/pycharm/matplotlib-tutorial.html

16

u/Alexanderdaawesome Aug 05 '19

Can verify, I do ALL of my function prototyping in Pycharm for its (and jetbrains in gerneral) debugging features.

11

u/Linkguy137 Aug 05 '19

I mean I use Spyder and it is in there

7

u/Blazerboy65 Aug 05 '19

In Python you'll usually get that kind of functionality using a debugger or a client like Spyder.

6

u/gmclapp Aug 05 '19

Basically any IDE besides IDLE

→ More replies (8)
→ More replies (4)