-3

I want to create a histogram with broken axes and found that there must be a module doing this called brokenaxes that works together with matplotlib (source) . Anyway, when I trie to import the module like this:

import matplotlib.pyplot as plt
from brokenaxes import brokenaxes

I get this error message:

No module named brokenaxes

I'm using ipython5.1 in anaconda 4.3.

Can anyone help me?

DavidG
  • 24,279
  • 14
  • 89
  • 82
SGeuer
  • 147
  • 1
  • 8

2 Answers2

3

In order to use a module it has to be installed. This can be done via

pip install brokenaxes

See https://docs.python.org/3/installing/

However, it seems that the brokenaxes you get from the python package index is currently (as of June 2017) broken (as the name says it ;-)). It should now (as of August 2017) be working again (see answer by package maintainer below).

Alternatively go to https://github.com/bendichter/brokenaxes, download the files and copy brokenaxes.py into your python's site-packages folder.

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712
  • Sorry, I am still a beginner. I tried to install like this: '(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>ipython -m pip install brokenaxes' and got many responses like this: Requirement already satisfied: brokenaxes in c:\programdata\anaconda3\lib\site-packagesRequirement already satisfied: matplotlib in C:\programdata\anaconda3\lib\site-packages (from brokenaxes). but it'still not working – SGeuer Jun 14 '17 at 11:53
  • I get the same error message when I try to import it: no module named broekenaxes – SGeuer Jun 14 '17 at 12:04
  • I guess you have installed it for the wrong python. Do you have several python distributions on your machine? In the question you say you're using Anaconda 4 but the install path you quote says Anaconda3. – ImportanceOfBeingErnest Jun 14 '17 at 12:06
  • sorry, that was a typo. it is anaconda3. but I do have python and ipython and installed it for both. Is that a problem – SGeuer Jun 14 '17 at 12:18
  • I just checked that brokenaxes is really in the site-packages folder of anaconda3 and this is the case. Can I somhow see, whether it was really installed? I don't have full rights on my computer working. could that cause problems? – SGeuer Jun 14 '17 at 12:25
  • just saw: I just have the ...info folder of brokenaxes but not the second one that I do have for packages that are working e.g. matplolib. Could it be that the installation went wron? – SGeuer Jun 14 '17 at 12:28
  • Something seems to be broken with the package. Go fetch the file directly from GitHub and copy it into your site-packages folder. I updated the answer. – ImportanceOfBeingErnest Jun 14 '17 at 12:40
  • I copied the py folder from [https://github.com/bendichter/brokenaxes] to my scripts. Is that the correct folder? I have problems using the package but I can import it and would start a new question for this problem if I took the correct file. – SGeuer Jun 14 '17 at 13:56
  • You can of course also copy the `brokenaxes.py` to the folder of your script. But you would then need to do that for every script you start in a new folder. So putting it into the site-packages folder might still be beneficial. Note that you only need the `brokenaxes.py`, you don't need the rest of the files to actually work with it. – ImportanceOfBeingErnest Jun 14 '17 at 14:06
  • see my answer. Sorry for the inconvenience, and thanks for letting me know. I monitor github, so if you have any more problems, please file an issue. – ben.dichter Aug 22 '17 at 22:58
1

Package creator here. There was a bug in the install script. It worked despite the bug in previous versions of pip, but if you have the most recent version the install broke. I fixed it today, so you should be able to run: pip install brokenaxes==0.2 to get the latest version. Sorry for the inconvenience and thanks for bringing this to my attention.

Ben

ben.dichter
  • 1,663
  • 15
  • 11