| 1 | package Chart::GGPlot::Scale::DiscreteIdentity; | ||
| 2 | |||
| 3 | # ABSTRACT: Discrete identity scale | ||
| 4 | |||
| 5 | use Chart::GGPlot::Class qw(:pdl); | ||
| 6 | use namespace::autoclean; | ||
| 7 | |||
| 8 | our $VERSION = '0.002003'; # VERSION | ||
| 9 | |||
| 10 | use Chart::GGPlot::Util qw(:all); | ||
| 11 | |||
| 12 | extends qw( | ||
| 13 | Chart::GGPlot::Scale::Discrete | ||
| 14 | ); | ||
| 15 | |||
| 16 | method map_to_limits ( $p, $limits = $self->get_limits ) { | ||
| 17 | if ($p->$_DOES('PDL::Factor')) { | ||
| 18 | return $p->as_pdlsv; | ||
| 19 | } else { | ||
| 20 | return $p; | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | method train ($p) { | ||
| 25 | return if $self->guide eq 'none'; | ||
| 26 | $self->SUPER::train($p); | ||
| 27 | } | ||
| 28 | |||
| 29 | __PACKAGE__->meta->make_immutable; | ||
| 30 | |||
| 31 | 1; | ||
| 32 | |||
| 33 | __END__ |