小编sun*_*lec的帖子

使用matplotlib在网格中显示值

我试图为一些数据生成热图,我的代码如下所示:

data = [['basis', 2007, 2008],
        [1, 2.2, 3.4],
        [2, 0, -2.2],
        [3, -4.1, -2.5],
        [4, -5.8, 1.2],
        [5, -5.4, -3.6],
        [6, 1.4, -5.9]]

x_header = data[0][1:]
y_header = [i for i in range(1, 13)]
data=data[1:]
for i in range(len(data)):
    data[i] = data[i][1:]
arr = np.array(data)
fig, ax = plt.subplots()
#heatmap = plt.pcolor(arr, cmap = 'RdBu')
norm = MidpointNormalize(midpoint=0)
im = ax.imshow(data, norm=norm, cmap=plt.cm.seismic, interpolation='none')

ax.set_xticks(np.arange(arr.shape[1]), minor=False)
ax.set_yticks(np.arange(arr.shape[0]), minor=False)
ax.xaxis.tick_top()
ax.set_xticklabels(x_header, rotation=90)
ax.set_yticklabels(y_header)

fig.colorbar(im)
plt.show()
Run Code Online (Sandbox Code Playgroud)

它生成图像

在此输入图像描述

我还想在网格中显示值.有没有办法做到这一点?

python matplotlib

10
推荐指数
1
解决办法
6339
查看次数

不同服务之间的Kerberos委派

我们使用httpd webservers进行以下设置,如下所示:

在此输入图像描述

Heres the scenario: Server A takes the request from Browser does some operations and creates a new request and sends it to Server B. User X is authenticated on Server B, but User Y is not (and it is not supposed to). Since A is creating a new request, B is thinking that Y has sent the request and so denying it. Removing Server A is not an option. How do I solve this. Can you …

apache authentication webserver kerberos httpd.conf

3
推荐指数
1
解决办法
942
查看次数

Serilog 记录到控制台但不记录到文件

我有以下记录器配置和相关类如下。预期的日志消息如下:

2019-03-06 19:49:56.417 +05:30 [INFORMATION] [Main] Start
2019-03-06 19:49:56.435 +05:30 [INFORMATION] [Test1] Test1 logg
Run Code Online (Sandbox Code Playgroud)

我在控制台中看到了两个日志消息。但我只看到文件中的第一个日志。

namespace SerilogTest
{
    public static class MyLogger
    {
        public static ILogger getLogger(String className)
        {
            string logTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u}] [{SourceContext}] {Message}{NewLine}{Exception}";

            Log.Logger = new LoggerConfiguration()
                .WriteTo.Console(outputTemplate: logTemplate)
                .WriteTo.File("log.txt", outputTemplate: logTemplate)
                .CreateLogger()
                .ForContext("SourceContext", className);

            return Log.Logger;
        }    
    }

    public class Program
    {
        private static ILogger Log = MyLogger.getLogger("Main");

        private static void Main(String[] args)
        {
            Log.Information("Start");
            Test1 t1 = new Test1();
            Console.ReadKey();
        }
    }

    public …
Run Code Online (Sandbox Code Playgroud)

c# serilog

1
推荐指数
1
解决办法
2349
查看次数