-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default aesthetics of the plots #32
Comments
I'll get to work on this next. |
@BradLarson @marcrasi to use a different font with AGG I will need to import truetype as a dependency. AGG has provisions to use different fonts using truetype. So, I tried importing this: https://github.com/PureSwift/CFreeType but I am getting this error: Fetching https://github.com/PureSwift/CFreeType.git
error: dependency graph is unresolvable; found these conflicting requirements:
Dependencies:
https://github.com/PureSwift/CFreeType.git @ 1.0.4 The repo has a 1.0.4 tag. Am I doing something wrong? |
By adding FreeType as a dependency, will that require FreeType to be installed as a library before using the AGG renderer? Or is that commonly installed on systems and in environments like Colab? What are you using in your Package.swift to pull in CFreeType? That error does sound odd, but I've hit that when I was trying to do an exact match and I got the release numbers slightly wrong. |
FreeType is commonly installed on Ubuntu atleast. I think the release number isn't a problem, because I cloned the repo, deleted the git repository, initialized my own git repository, pushed my own tag, but still got the same error. |
Sorry, mean to ask: what is the exact code you're using in your Package.swift? I can try it on my end with a dummy project to see if I can figure out what's wrong. |
import PackageDescription
let package = Package(
name: "SwiftPlot",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "SwiftPlot",
targets: ["AGG", "lodepng", "CPPAGGRenderer", "CAGGRenderer", "SwiftPlot", "SVGRenderer", "AGGRenderer"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/PureSwift/CFreeType.git", .exact("1.0.4")),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "AGG",
dependencies: [],
path: "framework/AGG"),
.target(.....other targets |
Ah, I think the real problem might be due to CFreeType relying on Swift Package Manager 3.0.2 tooling. If I instead use
I get the following error:
You could try forking that and updating the CFreeType package's tools version on your end to see if that lets you import it. |
This was the problem. I am able to import it now. |
@BradLarson @marcrasi I'm trying to use the code from this branch in Jupyter. But I'm unable to use FreeType there:
This is what I get. Also in the terminal I get this: |
It works when you do Is it possible that you're using different versions of the swift toolchain from the commandline and from jupyter? Try running these commands to see:
Maybe changing it to use a system library target (like you have in the commented out code in your CFreeType Package.swift) will help. Do you also get problems if you try it with that? |
Yes I do not remember remember the path which I used with jupyter. (I've got two versions). But I am pretty sure I must be using the same one. Using the system library targets gave errors when building on Mac. That's why I changed it. |
@marcrasi any ideas on how to get FreeType working in Jupyter? |
I'll try to run it myself today and see if I can figure anything out. |
Try adding this. I think it made it work for me: |
Thanks @marcrasi it builds now! |
Now that this is getting close enough to the point where people can start using it in notebooks, etc., I think it might help to improve some of the default aesthetics of the plots. The default settings for plots are producing graphs that aren't as aesthetically pleasing as other frameworks, but with a few slight tweaks to fonts, line size, spacing of numbers from the axis hatching, etc. I think the defaults could be made a lot nicer-looking.
For example, as a starting point, it would be nice if the following matplotlib plot:
https://matplotlib.org/gallery/lines_bars_and_markers/simple_plot.html#sphx-glr-gallery-lines-bars-and-markers-simple-plot-py
could be replicated using default settings for the framework, plus enabling a grid. Even that example isn't the greatest in terms of formatting, but people coming from matplotlib will expect something at least that readable.
We should find other examples of really nice-looking plots and see if they can be replicated in this framework with the right settings. That would give good targets for defaults on fonts, etc. at different plot sizes.
The text was updated successfully, but these errors were encountered: