Как добавить пользовательский цвет края в пузырьковый график, используя ggplot2

glob() и FilesystemIterator примеры:

/* 
 * glob() examples
 */

// get the array of full paths
$result = glob( 'path/*' );

// get the array of file names
$result = array_map( function( $item ) {
    return basename( $item );
}, glob( 'path/*' ) );


/* 
 * FilesystemIterator examples
 */

// get the array of file names by using FilesystemIterator and array_map()
$result = array_map( function( $item ) {
    // $item: SplFileInfo object
    return $item->getFilename();
}, iterator_to_array( new FilesystemIterator( 'path' ), false ) );

// get the array of file names by using FilesystemIterator and iterator_apply() filter
$it = new FilesystemIterator( 'path' );
iterator_apply( 
    $it, 
    function( $item, &$result ) {
        // $item: FilesystemIterator object that points to current element
        $result[] = (string) $item;
        // The function must return TRUE in order to continue iterating
        return true;
    }, 
    array( $it, &$result )
);

1
задан NelsonGon 17 January 2019 в 17:51
поделиться

1 ответ

Использование другого shape вместе с настройкой stroke и переключением fill с помощью color, кажется, работает:

ggplot(data, aes(x = Date_Id, 
                 y = Level.Of.Difficulty, size = Savings), show.legend = F) +
  geom_point(aes(fill = Source, alpha = 0.6), shape = 21, color = "red", stroke = 1.25) +
  geom_text(aes(label = Initiative), size = 4) +
  scale_size_continuous(range = c(1, 75)) +
  scale_y_discrete(limits = c("Low", "", "", "", "", "", "", "", "", "High")) +
  scale_x_discrete(limits = c("","","Sep-18","","","","","","",
                              "Oct-18", "","","","","","",
                              "Nov-18", "","","","","","",
                              "Dec-18", "","","","","","",
                              "Jan-19", "","","","","","",
                              "Feb-19", "","","","","","",
                              "Mar-19", "","","","","","",
                              "Apr-19", "","","","","","",
                              "May-19", "","","","","","",
                              "Jun-19", "","","","","","", "Jul-19")) +
  labs(x = "Date", y = "Level of Difficulty") +
  ggtitle("2019 SC Major Initiatives") + 
  scale_alpha(guide = 'none') +
  geom_vline(aes(xintercept = 33), size = 1.4) + 
  geom_hline(aes(yintercept = 5.5), size = 1.4,
             linetype = 6) +
  scale_fill_manual(values = c("#008000", "#0000FF")) +
  theme(plot.title = element_text(hjust = 0.5),
        legend.position = c(0.035, 0.035), 
        legend.background = element_blank(),
        legend.title = element_blank(),
        legend.text = element_text(size = 12),
        panel.background = element_blank(),
        axis.line = element_line(color = "black")) +
  guides(size = F)

enter image description here [ 118]

0
ответ дан Julius Vainora 17 January 2019 в 17:51
поделиться
Другие вопросы по тегам:

Похожие вопросы: