Scatterplot in seaborn 0.8 - python

I'm on a remote server where I have access to seaborn=0.8.1 and have no way of updating the package. I'd like to use seaborn.scatterplot, but I'm getting an error that the function does not exist.
Either the function did not exist in the older version, or it had a different name. I am unable to find earlier versions of the documentation (numpy does a great job of providing manuals for earlier versions), so I am kind of stuck here.
How do I find out the API for earlier versions of seaborn, and whether there are older alternatives to scatterplot?

You can use the GitHub repo to find documentation of older versions - just navigate to the correct tag that corresponds to your version, and enter the doc directory -
https://github.com/mwaskom/seaborn/tree/v0.8.1/doc
It's very common for documentation to be stored alongside the code and versioned along with it.
It seems the scatterplot function was added in 0.9 to seaborn/relational.py, which has the line:
__all__ = ["relplot", "scatterplot", "lineplot"], so "seaborn.scatterplot" gets "created" when seaborn/__init__.py performs from .relational import *.
I'm not sure if there's a similar function in v0.8.1. A quick search shows that class class _RegressionPlotter(_LinearPlotter) has a method called scatterplot in version 0.8.1, but I don't think it's the same (not familiar enough with Seaborn to know).

Related

How can vscode view detailed usage information for certain python package library functions? (like the sum function in pytorch)?

I used to use spyder-IDE for python programming, for example, I used the sum function in pytorch library, torch.sum(), using keyboard shortcut "ctrl+I" to quickly see how to use the function, input and output parameters, examples code and so on. However, with the latest pylance_v2021.9.1+vscode 1.6+pytorch 1.9 you cannot see the detailed help information, it seems that you can only see it by typing torch.sum()? in the terminal, Is there some extensions that provides this feature? Thank you!
Official vscode says (IntelliSense through the Pylance language server) that use pylance+pytorch 1.8.1 or later release support mouse hover to see pytroch detailed preview information, but I use the latest version of vscode 1.6+pytorch 1.9 but it doesn't work, it only shows function signature hints, not detailed help information.
2021.9.17 update, Description example update:
This image is the detailed help information of "torch.sum" obtained by spyder-IDE
However, it is not easy to get such detailed help information in vscode, but only the function signature shown below(left), unless you type torch.sum? in the python interactive window to see the full help information every time(right). Moreover, the full "Docstring" is not rendered, so it is not easy to read visually like spyder-IDE.
The above two use the same python environment,the various versions used areļ¼š vscoder1.6+pytorch1.9+(microsoft)python_v2021.9.1230869389+pylance_v2021.9.2, spyderIDE4.0
Have you click this?
Then it should be like this:
the sum would be like this:
But if you want to get more information, it depends on the docs, such as AdaptiveAvgPool2d:
But the sum does not contains that:

Where can I find all the properties for customization in matplotlib?

I'm trying to create my own style, like 'ggplot', and I'm looking for a dictionary or a guide where I can find all the customizable properties. At the end of this page of the documentation of matplotlib there is a file called 'matplotlibrc' and i want to know if that files contains all the possible options on customization or there is something else.
Yes, the example file contains all possible parameters. This file is embedded into each documentation built; and there is a test that ensures that whenever a new parameter is added or removed, this file is updated. So you can consider it being complete.
However, make sure to always refer to the version of the documentation that corresponds to your matplotlib version.
The most up to date version at any time is at
https://matplotlib.org/tutorials/introductory/customizing.html
while for example the version of matplotlib 3.0.3 would be available through
https://matplotlib.org/3.0.3/tutorials/introductory/customizing.html

How does searching with pip work?

Yes, I'm dead serious with this question. How does searching with pip work?
The documentation of the keyword search refers to a "pip search reference" at https://pip.pypa.io/en/stable/user_guide/#searching-for-packages which is everything but a reference.
I can't conclude from search attempts how searching works. E.g. if I search for "exec" I get a variety of results such as exec-pypeline (0.4.2) - an incredible python package. I even get results with package names that have nothing to do with "exec" as long as the term "exec" is in the description.
But strangely I don't see one of my own packages in the list though one of the packages contains exec in it's name. That alone now would lead us to the conclusion that pip (at least) searches for complete search terms in the package description (which my package doesn't have).
But building on that assumption if I search for other terms that are provided in the package description I don't get my package listed either. And that applies to other packages as well: E.g. if I search for "projects" I don't get flask-macros in the result set though the term "projects" clearly exists in the description of flask-macros. So as this contradicts the assumption above this is clearly not the way how searching works.
And interestingly I can search for "macro" and get "flask-macros" as a result, but if I search for "macr" "flask-macros" is not found.
So how exactly is searching performed by pip? Where can a suitable reference be found for this?
pip search looks for substring contained in the distribution name or the distribution summary. I can not see this documented anywhere, and found it by following the command in the source code directly.
The code for the search feature, which dates from Feb 2010, is still using an old xmlrpc_client. There is issue395 to change this, open since 2011, since the XML-RPC API is now considered legacy and should not be used. Somewhat surprisingly, the endpoint was not deprecated in the pypi-legacy to warehouse move, as the legacy routes are still there.
flask-macros did not show up in a search for "project" because this is too common a search term. Only 100 results are returned, this is a hardcoded limit in the elasticsearch view which handles the requests to those PyPI search routes. Note that this was reduced from 1000 fairly recently in PR3827.
Code to do a search with an API client directly:
import xmlrpc.client
client = xmlrpc.client.ServerProxy('https://pypi.org/pypi')
query = 'project'
results = client.search({'name': query, 'summary': query}, 'or')
print(len(results), 'results returned')
for result in sorted(results, key=lambda data: data['name'].lower()):
print(result)
edit: The 100 result limit is now documented here.

InDesign script labels in appscript python module

I'm using appscript to create an InDesign document from Database data, but I can't seem to figure out how to set the contents of the objects in my page. In older versions of ID (CS4 and earlier, if i'm correct) I could get the object with script label foo by calling spread.page_items['foo']. However, this does not seem to work anymore. spread.page_items.ID(<foo_id>).label.get() does show foo, so the script label is set correctly.
The Adobe documentation speaks of a label property, however I haven't yet figured out how to use that property to correctly select the right object.
If there is a way to obtain an object's ID easily, that might also do the trick.
I managed to solve this after finding this article about references in appscript. I had to use a filter, like so: spread.page_items[its.label == 'foo'].
Also, as suggested by Youngware below, the script labels support is indeed replaced by layer names.

How do I deal with conflicting names when building python docs with doxygen

I'm having a problem with Doxygen for Windows with Python where input files with the same failename cause a conflict wth the output files. This seems to be a bug in doxygen - is there a way to work-around this problem?
Background
We build docs for our API using Doxygen. Our project is overwhelmingly written in python and the only components that our clients care about are python. Due to accidents of history our classes often have unfortunate naming conventions.
For example we have a classes whose fully-qualified name are:
tools.b.foo.Foo
tools.b.bar.Bar
Later this class was re-implemented and put into a new module:
tools.c.foo.Foo_improved
tools.c.bar.Bar_improved
When we want to build our tools API documentation we have a process which checks out tools.* into a directory on the build-server and then we call doxygen with a fairly standard configuration file.
We'd expect that there should be four HTML files in the output, two for foo and two for bar. However what we get is only two files. Both sets of sripts are parsed, however since the module names are the same the documentation for the old version ends up over-writing the documentation which was generated for the new versions. As a result in every case where a python module name is duplicated (but in a different sub-package) we are only getting a single doc file for every file name.
FYI, we are using doxygen 1.7.1 on Windows XP 32bit with Python 2.4.4
Config file is here:
http://pastebin.me/002f3ec3145f4e1896a9cf79e7179493
UPDATE 1: In the generated doc index I can see entries for all four files, however if I follow the links to both Foo and Foo_improved both point to the same file.
You could try explicitly declaring a class w/ full namespace
http://www.doxygen.nl/manual/commands.html#cmdclass

Categories

Resources