Pretty Scientific Plotting with Minor-Tick and Log Minor-Tick Support

Functions to make useful (and pretty) plots for scientific plotting. Additional plotting features are added for base plotting, with particular emphasis on making attractive log axis plots.


News

v1.0

Not released on CRAN.

v1.1

CRAN legal- passed all checks.

v1.2

Bug Fixes:

x and y axis limits can now be reversed without error

New Features:

magplot parses better to plot, allowing generic plotting of plot.density plot.histogram etc.

Improved the behaviour of tick labelling by making use of the axis function (which tries hard to avoid text collisions).

Generalised the labelling system with a mid level function maglab. This makes it easier for the end user to cope with specific scenarios where the default behaviour is not desired.

Added more flexibility to control the outcome from magplot, meaning users should not need to access magaxis and maglab in most scenarios.

v1.3

Fixed: when labels were FALSE plotting ticks alone wasn't working

Changed code to use mtext instead of title for axis labels- this means labels are plotted when using layout.

Fixed: a couple of plot label formatting issues. This fixes some situations where expressions were not being used, and changes 0x10^0 to 0.

New Features:

Allowed nice printing of smaller dynamic ranges in log plots by using powers of 10 times 1, 2 and 5 when the range covered is less than or equal to 50.

v1.4

Bug Fixes:

Clarified some help entries, and fixed some typos.

Fixed: bug with logpretty in magaxis that meant it wasn't dealing with vector arguments correctly.

New Features:

Added vector support for majorn minorn so they can be defined separately for each axis.

Added option to define the pretty gap to aim for (useful for degrees which are 45/90 rather than 50/100). This is prettybase- as an example this can be set to 45 for plotting degrees nicely.

v1.5

Added option for fully Hershey font output.

Added magerr error bar plotting function.

Added magmap variable mapping functions to allow for pretty and easy colour scaling.

Added a hard trim option to maglab to ensure no values fall outside of original range.

Fixed: some help entries (nothing serious).

Fixed: bug in usemultloc that extended the range beyond that desired.

v1.6

Added the magrun plotting feature, which allows for easy generation of running medians and other quantiles.

Fixed: some help file entries

Added pretty in-plot colour bar. This makes 'magic' use of the plotrix version, i.e. it works hard to produce a useful output painlessly.

v 1.7

Fixed: error in magmap that meant flip was always from 0 -> range[2]-range[1], not from range[1] -> range[2]

v 1.8

Feature: MagCon now has capability for xlim/ylim calls. This is useful for viewing a subset of your data and/or having inverted axes.

Feature: Added 'weights' option to magcon

Fixed: Various documentation typos.

Fixed: passing error where the 'main' argument wasn't being correctly passed to magplot, so was being ignored when the user had x and y objects.

Fixed: how the 'bad' flag in magmap works

Fixed: documentation error in magcon- description was cut short by '%' rather than using '%'

Fixed: magbar didn’t seem to function as expected when being overlaid on a plot with logged axes.

Fixed: magbar colour bar changed range depending on how many intervals you request. i.e. the same bar settings called with labN=5 has different limits when called with labN=3. magbar now pads out the extremes of the mapping if the pretty plotting chooses to extend beyond the requested range (which it generally will).

v 1.9

Feature: magmap can now output NA outside of the desired range.

Feature: magbar can now simply show the background outside the clipped range (previously padded out the extreme colour, which might not always be the most meaningful thing to do).

Fixed: log scaling had issues in magbar when the pretty scale went outside the nominal range (the mapping was not correct in some circumstances).

Fixed: box function in magaxis now inherits the bty type from par.

Fixed: Various documentation typos.

v 1.9.1

Fixed: magplot now has side option to create segments of the plot axes. This is instead of using bty in par (which only affects the box in plot, not the axis labelling). I prefer my behaviour, i.e. you can generate ticks and tick labels on the side you want straight from magplot (which isn't possible with plot). This does mean magplot behaves slightly differently to plot, but this is unavoidable for the high level plotting I desire.

v 1.9.2

Feature: Added error ellispe option in magerr function.

v 1.9.3

Feature: Added stretch option to magmap, which now takes arguments 'lin' for linear, 'log' for log, 'atanh' for atanh and 'asinh' for asinh. The option 'log' no longer exists in magmap, which could break code written prior to magicaxis v1.9.3.

Feature: The background colour of the magcon image now extends beyond the limits of the data if necessary.

Feature: magerr now picks up the log state automatically, so log argument is no longer required.

v 1.9.4

WARNING! Argument change: tline no longer exists as an option for magplot or magaxis, instead the user defines the full mgp vector, where it has "pretty" defaults of c(2,0.5,0).

Feature: Added usepar option to magplot and magaxis. Setting this to TRUE forces both of these functions to use the global par setting for tcl and mgp, rather than the function level arguments (they become over-ridden). This should allow users to change settings globally, which is preferred for scripting uses.

Fixed: magerr now only attempts to plot error ellipses when the ellipse has area, i.e. both xlo and xhi must be above 0. Before it would plot lots of ellipses with 0 area, i.e. a point, and this could take a lot of unnecessary time.

Feature: magerr will now draw an error bar when xlo or xhi is 0 and corxy has been provided, i.e. since it can't draw an ellipse with width 0 it draws an error bar instead.

Fixes: All magplot options now passed onto magaxis. This was suggested by Raphael Felber, and was a change I had long been meaning to make.

Feature: side=FALSE in magplot will now not plot any sides (in this case the user could just have used plot, but adding this option makes scripting easier)

License: Changed to GPL-3 after a user request.

v 2.0.0

Enough new features to transition to magicaxis version 2.0

Feature: Added magimage (one chanel) and magimageRGB (three chanel) image functions

Feature: Added magtri function to make nice triangle plots of MCMC psoterior chains with a simple high level interface.

Feature: Added projected coordinate plotting via magproj.

Feature: Added function magband.

Feature: Added background grid options for magaxis and magplot.

Feature: Added Nbins output to magrun. This effectively produces a histogram counts output for the final bin limits.

Feature: magplot dots (...) now also get sent to magaxis -> axis, previously they only went to plot.

Fix: cex.lab wasn't being passed to magaxis, now it is., i.e. par(cex.lab=2) will work.

Fix: doc typos

Feature: Extended the contours for magcon silently so they extend over the full plot window.

Feature: You can now parse a two column matrix or data.frame to x in magcon (rather than having to specify y separately).

Fix: Now parse 'tick' through to magaxis.

Feature: Added powbase option to allow log axes to be labelled with powers of e.g. 2 (1,2,4,8 etc) rather than only 10. To accommodate this working nicely minorn now has a default 'auto' mode which does sensible minor tick guess-work.

--

v 2.0.1

Fixed magmap docs

Fixed auto scale in magmap so it works with NA and NaN situations.

Fixed issue with magmap where a matrix could change type to vector (when all elements were the same).

Feature: Added cdf scaling to magmap.

Feature: Added maghist for pretty histograms.

Feature: Added magclip for smart automatic sigma clipping of data. Can be used in maghist and magplot too for xlim/ylim.

Feature: Added sparse sampling to magimage for faster image display.

--

v 2.0.2

Feature: Added lots of new WCS support functions, e.g. see magimageWCS.

Small magproj fixes.

v 2.0.3

Feature: Added shiftloc and paddim arguments to magcutout and magcutoutWCS. Indented version number to make sure ProFit works okay.

v 2.0.4

Lots of WCS features added.

xlab and ylab now follow side (feature suggestion by Roberto Canteri).

Minor bug fixes.

v 2.0.5

Added lwd.axis and lwd.ticks options that offer better control of the axes.

v 2.0.6

Added magcurve function for nice function curves.

v 2.0.7

Fixed issue with passing lwd through magplot.

TO DO:

FEATURE: Add better in-plot legends.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("magicaxis")

2.0.10 by Aaron Robotham, 2 months ago


Browse source code at https://github.com/cran/magicaxis


Authors: Aaron Robotham


Documentation:   PDF Manual  


GPL-3 license


Imports grDevices, graphics, stats, celestial, MASS, plotrix, sm, mapproj, RColorBrewer

Suggests imager


Imported by PAFit, RadioGx, staTools.

Depended on by ProFit, ProFound, hyper.fit, nlshelper.


See at CRAN